From 4fabd1503c273f9e1734d646038da8bce0757af6 Mon Sep 17 00:00:00 2001 From: sof Date: Thu, 14 Feb 2002 09:00:41 +0000 Subject: [PATCH] [project @ 2002-02-14 09:00:41 by sof] make multi-threading story work under win32 also --- ghc/rts/OSThreads.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/ghc/rts/OSThreads.c b/ghc/rts/OSThreads.c index a0d3ca8..abfa583 100644 --- a/ghc/rts/OSThreads.c +++ b/ghc/rts/OSThreads.c @@ -112,8 +112,8 @@ void initCondition( Condition* pCond ) { HANDLE h = CreateEvent(NULL, - TRUE, /* manual reset */ - TRUE, /* initially signalled */ + FALSE, /* auto reset */ + FALSE, /* initially not signalled */ NULL); /* unnamed => process-local. */ if ( h == NULL ) { @@ -157,6 +157,13 @@ waitCondition ( Condition* pCond, Mutex* pMut ) } void +yieldThread() +{ + Sleep(0); + return; +} + +void shutdownThread() { _endthreadex(0); @@ -174,12 +181,12 @@ int createOSThread ( OSThreadId* pId, void (*startProc)(void)) { - return _beginthreadex ( NULL, /* default security attributes */ - 0, - startProcWrapper, - (void*)startProc, - 0, - (unsigned*)pId); + return (_beginthreadex ( NULL, /* default security attributes */ + 0, + startProcWrapper, + (void*)startProc, + 0, + (unsigned*)pId) == NULL); } OSThreadId -- 1.7.10.4