From: Volker Lendecke Date: Tue, 12 Dec 2017 22:07:39 +0000 (+0100) Subject: pthreadpool: Fix deadlock X-Git-Tag: talloc-2.1.11~242 X-Git-Url: http://git.samba.org/?p=samba.git;a=commitdiff_plain;h=dfc4670640341761b346065922a62a3e755e9e58 pthreadpool: Fix deadlock Christof's idea from https://lists.samba.org/archive/samba-technical/2017-December/124384.html was that the thread already exited. It could also be that the thread is not yet idle when the new pthreadpool_add_jobs comes around the corner. Signed-off-by: Volker Lendecke Reviewed-by: Christof Schmitt Autobuild-User(master): Christof Schmitt Autobuild-Date(master): Wed Dec 13 04:46:12 CET 2017 on sn-devel-144 --- diff --git a/lib/pthreadpool/tests_cmocka.c b/lib/pthreadpool/tests_cmocka.c index 75a935fa42c..9753d212e1c 100644 --- a/lib/pthreadpool/tests_cmocka.c +++ b/lib/pthreadpool/tests_cmocka.c @@ -28,6 +28,7 @@ #include #include +#include struct pthreadpool_tevent_test { struct tevent_context *ev; @@ -152,6 +153,8 @@ static void test_create(void **state) assert_return_code(ret, 0); assert_false(in_main_thread); + poll(NULL, 0, 10); + /* * Workerthread will still be active for a second; immediately * running another job will also use the worker thread, even