From cb06585ca5d1957da27c63d30925b270d9aa926b Mon Sep 17 00:00:00 2001 From: Martin Stjernholm <mast@lysator.liu.se> Date: Sat, 25 Apr 2009 20:01:53 +0200 Subject: [PATCH] Some FIXMEs for locks on Windows, and a clarifying comment. --- src/pike_threadlib.h | 5 +++++ src/threads.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/pike_threadlib.h b/src/pike_threadlib.h index 8e8112f6b9..4fd9fc7f2b 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 aa8267d968..cc38355452 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); -- GitLab