From 520dba8f2897914f2ceccc1e916009a3b00c3ad9 Mon Sep 17 00:00:00 2001 From: davidxu Date: Thu, 3 May 2012 09:17:31 +0000 Subject: MFp4: Enqueue thread in LIFO, this can cause starvation, but it gives better performance. Use _thr_queuefifo to control the frequency of FIFO vs LIFO, you can use environment string LIBPTHREAD_QUEUE_FIFO to configure the variable. --- lib/libthr/thread/thr_init.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/libthr/thread/thr_init.c') diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c index 86abad8..e1e304a 100644 --- a/lib/libthr/thread/thr_init.c +++ b/lib/libthr/thread/thr_init.c @@ -112,6 +112,7 @@ size_t _thr_stack_initial = THR_STACK_INITIAL; int _thr_page_size; int _thr_spinloops; int _thr_yieldloops; +int _thr_queuefifo = 4; int _gc_count; struct umutex _mutex_static_lock = DEFAULT_UMUTEX; struct umutex _cond_static_lock = DEFAULT_UMUTEX; @@ -470,6 +471,9 @@ init_private(void) env = getenv("LIBPTHREAD_YIELDLOOPS"); if (env) _thr_yieldloops = atoi(env); + env = getenv("LIBPTHREAD_QUEUE_FIFO"); + if (env) + _thr_queuefifo = atoi(env); TAILQ_INIT(&_thr_atfork_list); } init_once = 1; -- cgit v1.1