WIP tevent: API update tevent_threadpool_send()
authorStefan Metzmacher <metze@samba.org>
Tue, 26 Jul 2016 15:34:28 +0000 (17:34 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 17 May 2018 07:51:50 +0000 (09:51 +0200)
lib/tevent/tevent.h
lib/tevent/tevent_threads.c

index e1210c9863d4da23995a5dcc65c735d15d002b77..45e5bb9e4380b8091c2feb5d5695282cc70cce3e 100644 (file)
@@ -2037,21 +2037,16 @@ struct tevent_threadpool_job *_tevent_threadpool_job_create(TALLOC_CTX *mem_ctx,
 /**
  * @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
index 28571311247898aa467212aeb650fb20e42d5d6f..43d5a3e457c81847d1d209c0fd7196b154bc7b7d 100644 (file)
@@ -1256,13 +1256,15 @@ struct tevent_threadpool_job *_tevent_threadpool_job_create(TALLOC_CTX *mem_ctx,
        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;
        }