Show Table of Contents
Chapter 51. Functions for Server Tasks
Directory Server tasks are usually maintenance operations for the server, such as indexing entries or importing an LDIF file.
Certain server tasks can be performed through a special task plug-in. When a task entry is added to the
cn=tasks subtree in the directory, the task's handler is called and performs the task.
This chapter describes functions available for task structures.
Table 51.1. Routines for Task Plug-ins
| Function | Description |
|---|---|
| slapi_destroy_task() | Frees a Slapi_Task structure when the task is completed. |
| slapi_plugin_new_task() | Creates a new server task and returns a pointer to the Slapi_Task structure. |
| slapi_task_begin() | Updates a task entry to indicate that the task is running. |
| slapi_task_cancel() | Cancels a current task. |
| slapi_task_dec_refcount() | Decrements the task reference count. |
| slapi_task_finish() | Called when the process is complete to write to the task entry and to return the result code. |
| slapi_task_get_data() | Retrieves an opaque data pointer from the task. |
| slapi_task_get_refcount() | Checks the current reference count of the task. If a task has multiple threads, this shows whether the individual tasks have completed. |
| slapi_task_get_state() | Shows the current state of the task. |
| slapi_task_inc_progress() | Automatically increments the task progress, which updates the task entry. |
| slapi_task_inc_refcount() | Increments the task reference count, if the task uses multiple threads. |
| slapi_task_log_notice() | Writes changes to a log attribute for the task entry. |
| slapi_task_log_status() | Updates the task status attribute in the entry to maintain a running display of the task status. |
| slapi_plugin_task_register_handler() | Registers a task handler function. |
| slapi_plugin_task_unregister_handler() | Unregisters a plug-in task. |
| slapi_task_set_cancel_fn() | Sets a callback to be used when a task is canceled. |
| slapi_task_set_data() | Appends an opaque object pointer to the task process. |
| slapi_task_set_destructor_fn() | Sets a callback to be used when a task is destroyed. |
| slapi_task_status_changed() | Contains the task's status. |
51.1. slapi_destroy_task()
Frees a
Slapi_Task structure. This does not update the task status, so this function should only be used to free a task that was not started processing with slapi_task_begin(). For tasks were started processing with slapi_task_begin(), slapi_task_finish() or slapi_task_cancel() to update the tasks status and free the task structure.
This function calls any custom destructor callback functions that have been set, so it is safe to use this function even if some private task data are set with slapi_task_set_data().
Syntax
void slapi_destroy_task(void *arg)
Parameters
This function takes the following parameter:
| arg | Contains arguments to passed to the task. |

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.