summaryrefslogtreecommitdiffstats
path: root/src/server/threadpool.c
diff options
context:
space:
mode:
authorSimon Rettberg2015-01-09 18:08:41 +0100
committerSimon Rettberg2015-01-09 18:08:41 +0100
commiteb834c44f91410d190eedb27c731943fec1f5153 (patch)
treea1a327b37de46e914ef173fd63c31ee865baadd6 /src/server/threadpool.c
parent[SERVER] Set client connection timeout in client thread (diff)
downloaddnbd3-eb834c44f91410d190eedb27c731943fec1f5153.tar.gz
dnbd3-eb834c44f91410d190eedb27c731943fec1f5153.tar.xz
dnbd3-eb834c44f91410d190eedb27c731943fec1f5153.zip
[SERVER] Support blocking signals, saves a syscall in threadpool
Diffstat (limited to 'src/server/threadpool.c')
-rw-r--r--src/server/threadpool.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/server/threadpool.c b/src/server/threadpool.c
index 34e996c..fd90944 100644
--- a/src/server/threadpool.c
+++ b/src/server/threadpool.c
@@ -60,7 +60,7 @@ bool threadpool_run(void *(*startRoutine)(void *), void *arg)
printf( "[WARNING] Could not alloc entry_t for new thread\n" );
return false;
}
- entry->signalFd = signal_new();
+ entry->signalFd = signal_newBlocking();
if ( entry->signalFd < 0 ) {
printf( "[WARNING] Could not create signalFd for new thread pool thread\n" );
free( entry );
@@ -90,7 +90,7 @@ static void *threadpool_worker(void *entryPtr)
entry_t *entry = (entry_t*)entryPtr;
for ( ;; ) {
// Wait for signal from outside that we have work to do
- int ret = signal_wait( entry->signalFd, -1 );
+ int ret = signal_clear( entry->signalFd );
if ( _shutdown ) break;
if ( ret > 0 ) {
if ( entry->startRoutine == NULL ) {