/**
* @brief Schedule a computation to run in a threadpool
*
- * private_data must be a pointer to a talloced object that is owned
- * by the calling main thread and must not be freed in the worker
- * thread.
- *
- * The computation can be cancelled by calling talloc_free() on the
- * tevent_req.
- *
- * @param[in] pool The threadpool to use
- * @param[in] fn Computation funtion to run
- * @param[in] private_data talloced data to hand to the computation function
- * @return tevent request on sucess, NULL on failure
+ * @param[in] mem_ctx The talloc memory context to use.
+ * @param[in] ev The event handle to setup the request.
+ * @param[in] pool The threadpool to use
+ * @param[in] job The job to run
+ * @return tevent request on sucess, NULL on failure
*/
-struct tevent_req *tevent_threadpool_send(struct tevent_threadpool *pool,
- void (*fn)(void *private_data),
- void *private_data);
+struct tevent_req *tevent_threadpool_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct tevent_threadpool *pool,
+ struct tevent_threadpool_job *job);
/**
* @brief Get the result of a computation
return job;
}
-struct tevent_req *tevent_threadpool_send(struct tevent_threadpool *pool,
+struct tevent_req *tevent_threadpool_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct tevent_threadpool *pool,
struct tevent_threadpool_job *job)
{
struct tevent_req *req;
struct tevent_threadpool_state *state;
- req = tevent_req_create(pool, &state, struct tevent_threadpool_state);
+ req = tevent_req_create(mem_ctx, &state, struct tevent_threadpool_state);
if (req == NULL) {
return NULL;
}