From: simonmar Date: Fri, 21 Oct 2005 15:14:06 +0000 (+0000) Subject: [project @ 2005-10-21 15:14:06 by simonmar] X-Git-Tag: Initial_conversion_from_CVS_complete~149 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=9b6f67f3d3a317d2d52948b70b723845974461b8;hp=7bb59f381da3728f53ae5ea1bf821154f53c3f94;p=ghc-hetmet.git [project @ 2005-10-21 15:14:06 by simonmar] Fix Win32 build --- diff --git a/ghc/rts/win32/AwaitEvent.c b/ghc/rts/win32/AwaitEvent.c index 6986bc9..d9e2cbc 100644 --- a/ghc/rts/win32/AwaitEvent.c +++ b/ghc/rts/win32/AwaitEvent.c @@ -14,11 +14,9 @@ */ #include "Rts.h" #include "Schedule.h" +#include "AwaitEvent.h" #include #include "win32/AsyncIO.h" -#if defined(THREADED_RTS) -#include "Capability.h" -#endif // Used to avoid calling abandonRequestWait() if we don't need to. // Protected by sched_mutex. @@ -29,23 +27,11 @@ awaitEvent(rtsBool wait) { int ret; -#ifdef THREADED_RTS - // Small optimisation: we don't want the waiting thread to wake - // up straight away just because a previous returning worker has - // called abandonRequestWait(). If the event is no longer needed, - // reset it. We must do this inside the sched_mutex. - if (!needToYieldToReturningWorker()) { - resetAbandonRequestWait(); - } -#endif - do { /* Try to de-queue completed IO requests */ workerWaitingForRequests = 1; - RELEASE_LOCK(&sched_mutex); ret = awaitRequests(wait); - ACQUIRE_LOCK(&sched_mutex); workerWaitingForRequests = 0; if (!ret) { return; /* still hold the lock */ @@ -55,23 +41,9 @@ awaitEvent(rtsBool wait) // // - we were interrupted // - new threads have arrived - // - another worker wants to take over (THREADED_RTS) } while (wait && !interrupted - && run_queue_hd == END_TSO_QUEUE -#ifdef THREADED_RTS - && !needToYieldToReturningWorker() -#endif + && emptyRunQueue(&MainCapability) ); } - -#ifdef THREADED_RTS -void -wakeBlockedWorkerThread() -{ - if (workerWaitingForRequests) { - abandonRequestWait(); - } -} -#endif diff --git a/ghc/rts/win32/ConsoleHandler.c b/ghc/rts/win32/ConsoleHandler.c index 4e470b3..e17b529 100644 --- a/ghc/rts/win32/ConsoleHandler.c +++ b/ghc/rts/win32/ConsoleHandler.c @@ -10,6 +10,7 @@ #include "RtsUtils.h" #include "RtsFlags.h" #include "AsyncIO.h" +#include "RtsSignals.h" extern int stg_InstallConsoleEvent(int action, StgStablePtr *handler); @@ -156,10 +157,13 @@ void startSignalHandlers(void) handler = deRefStablePtr((StgStablePtr)console_handler); while (stg_pending_events > 0) { stg_pending_events--; - scheduleThread( - createIOThread(RtsFlags.GcFlags.initialStkSize, - rts_apply((StgClosure *)handler, - rts_mkInt(stg_pending_buf[stg_pending_events])))); + scheduleThread(&MainCapability, + createIOThread(&MainCapability, + RtsFlags.GcFlags.initialStkSize, + rts_apply(&MainCapability, + (StgClosure *)handler, + rts_mkInt(&MainCapability, + stg_pending_buf[stg_pending_events])))); } unblockUserSignals(); }