Hi,
Happy holiday to all. :-)
With the thread pool support patch[1] sit in bugzilla, recently I found
it needs to have a cleanup function for the task pushed/scheduled. Also,
it would be useful for a worker thread being able to get the owner.
So I would like to propose a change and an addition,
Addition:
/**
* Get owner of the task currently been executed by the thread.
* @param thd The thread is executing a task
* @param owner Pointer to receive owner of the task.
* @return APR_SUCCESS if the owner is retrieved successfully
*/
APR_DECLARE(apr_status_t) apr_thread_pool_task_owner_get(apr_thread_t *
thd, void **owner);
Change:
APR_DECLARE(apr_status_t) apr_thread_pool_push(apr_thread_pool_t * me,
apr_thread_start_t func,
void *param,
apr_byte_t priority,
void *owner);
to either
APR_DECLARE(apr_status_t) apr_thread_pool_push(apr_thread_pool_t * me,
apr_thread_start_t func,
void *param,
apr_byte_t priority,
void *owner,
apr_status_t (*cleanup) (void*));
or
APR_DECLARE(apr_status_t) apr_thread_pool_push(apr_thread_pool_t * me,
apr_thread_start_t func,
void *param,
void *owner,
...);
Where ... would be optional parameters provided as
apr_byte_t priority, apr_status_t (*cleanup) (void*)
The later maybe a good for potential parameters, but I don't see the
need for now.
Comments?
[1] http://issues.apache.org/bugzilla/show_bug.cgi?id=41061
Cheers,
Henry