diff options
author | Simon Rettberg | 2019-08-05 12:47:15 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-08-05 12:47:15 +0200 |
commit | 71c707da4e5405c986399c3f4505fa0a554548ba (patch) | |
tree | b0c3c4d7fcce542d102b1788aee7d555ce2904d7 /src/server/threadpool.c | |
parent | [SERVER] Switch threadpool back to spinlock, add idle thread counter (diff) | |
download | dnbd3-71c707da4e5405c986399c3f4505fa0a554548ba.tar.gz dnbd3-71c707da4e5405c986399c3f4505fa0a554548ba.tar.xz dnbd3-71c707da4e5405c986399c3f4505fa0a554548ba.zip |
[SERVER] Add sanity check to threadpool_run for NULL routine
Diffstat (limited to 'src/server/threadpool.c')
-rw-r--r-- | src/server/threadpool.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/server/threadpool.c b/src/server/threadpool.c index c01ae7a..340a98d 100644 --- a/src/server/threadpool.c +++ b/src/server/threadpool.c @@ -50,6 +50,10 @@ void threadpool_close() bool threadpool_run(void *(*startRoutine)(void *), void *arg) { + if ( startRoutine == NULL ) { + logadd( LOG_ERROR, "Trying to queue work for thread pool with NULL startRoutine" ); + return false; // Or bail out!? + } pthread_spin_lock( &poolLock ); entry_t *entry = pool; if ( entry != NULL ) { |