diff --git a/src/pike_threadlib.h b/src/pike_threadlib.h index 8e8112f6b9304ed5acb82c29c761a3e893739ef4..4fd9fc7f2be60f1758d9c9aefdf0ea0b9f70ff0a 100644 --- a/src/pike_threadlib.h +++ b/src/pike_threadlib.h @@ -320,6 +320,8 @@ extern pthread_attr_t small_pattr; #define th_equal(X,Y) ((X)==(Y)) #define th_hash(X) (X) +/* FIXME: Check if we can switch to the cheaper CRITICAL_SECTION objects. */ + #define PIKE_MUTEX_T HANDLE #define mt_init(X) LOW_THREAD_CHECK_ZERO_ERROR ((*(X)=CreateMutex(NULL, 0, NULL))) #define mt_lock(X) \ @@ -346,6 +348,9 @@ extern pthread_attr_t small_pattr; #define th_atfork_parent() #define th_atfork_child() +/* FIXME: Use windows condition variables if running on Vista or + * Windows Server 2008. */ + #endif /* NT_THREADS */ diff --git a/src/threads.c b/src/threads.c index aa8267d9686661bef583477db53a4d940c17893d..cc38355452ef5237f436a4aef972513e6603216b 100644 --- a/src/threads.c +++ b/src/threads.c @@ -170,6 +170,9 @@ PMOD_EXPORT int co_wait(COND_T *c, MUTEX_T *m) mt_unlock(& c->lock); mt_unlock(m); + + /* NB: No race here since the event is manually reset. */ + event_wait(&me.event); mt_lock(m);