summaryrefslogtreecommitdiff
path: root/common/tpool.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/tpool.c')
-rw-r--r--common/tpool.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/common/tpool.c b/common/tpool.c
index f980b86..ff868de 100644
--- a/common/tpool.c
+++ b/common/tpool.c
@@ -35,7 +35,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
-#include <err.h>
#include <string.h>
#include <assert.h>
#include <signal.h>
@@ -43,6 +42,7 @@
#define __USE_GNU
#include <pthread.h>
+#include "compat.h"
#include "tpool.h"
typedef struct _tpool_work {
@@ -319,7 +319,13 @@ tpool_add_work (void (*routine)(void*), void *arg)
*/
if (tpool_max_queue_size > 0 && tpool_cur_queue_size >= tpool_max_queue_size) {
PTHREQ (pthread_mutex_unlock (&tpool_queue_lock));
+#if defined(HAVE_THR_YIELD)
+ thr_yield();
+#elif defined(HAVE_PTHREAD_YIELD)
pthread_yield();
+#elif defined(HAVE_SCHED_YIELD)
+ sched_yield();
+#endif
PTHREQ (pthread_mutex_lock (&tpool_queue_lock));
}