Revert "pthreadpool: add pthreadpool_tevent_job_cancel()"
authorRalph Boehme <slow@samba.org>
Fri, 28 Dec 2018 08:03:34 +0000 (09:03 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 11 Jan 2019 22:11:14 +0000 (23:11 +0100)
This reverts commit 791c05144ee9296024cc0fdebe4afeaaf67e26bc.

See the discussion in

https://lists.samba.org/archive/samba-technical/2018-December/131731.html

for the reasoning behind this revert.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/pthreadpool/pthreadpool_tevent.c

index 7fc49ce671e3a69181d89c74bb73654ea5d7bb56..6999730f25501f13c43094da2ed7774b92b174ad 100644 (file)
@@ -273,7 +273,6 @@ static void pthreadpool_tevent_job_fn(void *private_data);
 static void pthreadpool_tevent_job_done(struct tevent_context *ctx,
                                        struct tevent_immediate *im,
                                        void *private_data);
-static bool pthreadpool_tevent_job_cancel(struct tevent_req *req);
 
 static int pthreadpool_tevent_job_destructor(struct pthreadpool_tevent_job *job)
 {
@@ -448,7 +447,6 @@ struct tevent_req *pthreadpool_tevent_job_send(
                return tevent_req_post(req, ev);
        }
 
-       tevent_req_set_cancel_fn(req, pthreadpool_tevent_job_cancel);
        return req;
 }
 
@@ -530,44 +528,6 @@ static void pthreadpool_tevent_job_done(struct tevent_context *ctx,
        tevent_req_done(state->req);
 }
 
-static bool pthreadpool_tevent_job_cancel(struct tevent_req *req)
-{
-       struct pthreadpool_tevent_job_state *state =
-               tevent_req_data(req,
-               struct pthreadpool_tevent_job_state);
-       struct pthreadpool_tevent_job *job = state->job;
-       size_t num;
-
-       if (job == NULL) {
-               return false;
-       }
-
-       num = pthreadpool_cancel_job(job->pool->pool, 0,
-                                    pthreadpool_tevent_job_fn,
-                                    job);
-       if (num == 0) {
-               /*
-                * It was too late to cancel the request.
-                */
-               return false;
-       }
-
-       /*
-        * It was not too late to cancel the request.
-        *
-        * We can remove job->im, as it will never be used.
-        */
-       TALLOC_FREE(job->im);
-
-       /*
-        * pthreadpool_tevent_job_cleanup()
-        * will destroy the job.
-        */
-       tevent_req_defer_callback(req, state->ev);
-       tevent_req_error(req, ECANCELED);
-       return true;
-}
-
 int pthreadpool_tevent_job_recv(struct tevent_req *req)
 {
        return tevent_req_simple_recv_unix(req);