1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
samba-mirror/source3/lib/pthreadpool
Volker Lendecke 1c4284c739 pthreadpool: Slightly serialize jobs
Using the new msg_source program with 1.500 instances against a single
msg_sink I found the msg_source process to spawn two worker threads for
synchronously sending the data towards the receiving socket. This should
not happen: Per destination node we only create one queue. We strictly
only add pthreadpool jobs one after the other, so a single helper thread
should be perfectly sufficient.

It turned out that under heavy overload the main sending thread was
scheduled before the thread that just had finished its send() job. So
the helper thread was not able to increment the pool->num_idle variable
indicating that we don't have to create a new thread when the new job
is added.

This patch moves the signalling write under the mutex. This means that
indicating readiness via the pipe and the pool->num_idle variable happen both
under the same mutex lock and thus are atomic. No superfluous threads anymore.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-08-23 00:24:18 +02:00
..
Makefile s3: Many pthreadpool fixes 2011-04-25 09:50:32 +02:00
pthreadpool_sync.c pthreadpool: Allow multiple jobs to be received 2014-03-27 06:06:11 +01:00
pthreadpool.c pthreadpool: Slightly serialize jobs 2014-08-23 00:24:18 +02:00
pthreadpool.h pthreadpool: Allow multiple jobs to be received 2014-03-27 06:06:11 +01:00
tests.c pthreadpool: Allow multiple jobs to be received 2014-03-27 06:06:11 +01:00
wscript_build build: Do not install testing binaries 2012-11-22 12:00:36 +01:00