X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FRtsAPI.c;h=d79da3d18063a85b06e4e8c5a3914f7d48874e36;hb=182b16bccea2eab1a8af93a6246db3d391e436c7;hp=835db722d788e37f95c02135fdcc2eaec41ceb9d;hpb=aefc6956f4828708e1343cf4858296fc3141a176;p=ghc-hetmet.git diff --git a/ghc/rts/RtsAPI.c b/ghc/rts/RtsAPI.c index 835db72..d79da3d 100644 --- a/ghc/rts/RtsAPI.c +++ b/ghc/rts/RtsAPI.c @@ -1,5 +1,5 @@ /* ---------------------------------------------------------------------------- - * $Id: RtsAPI.c,v 1.48 2003/10/01 10:36:49 wolfgang Exp $ + * $Id: RtsAPI.c,v 1.51 2003/12/17 12:17:18 simonmar Exp $ * * (c) The GHC Team, 1998-2001 * @@ -76,10 +76,10 @@ rts_mkInt32 (HsInt32 i) HaskellObj rts_mkInt64 (HsInt64 i) { - long long *tmp; + llong *tmp; StgClosure *p = (StgClosure *)allocate(CONSTR_sizeW(0,2)); SET_HDR(p, I64zh_con_info, CCS_SYSTEM); - tmp = (long long*)&(p->payload[0]); + tmp = (llong*)&(p->payload[0]); *tmp = (StgInt64)i; return p; } @@ -126,12 +126,12 @@ rts_mkWord32 (HsWord32 w) HaskellObj rts_mkWord64 (HsWord64 w) { - unsigned long long *tmp; + ullong *tmp; StgClosure *p = (StgClosure *)allocate(CONSTR_sizeW(0,2)); /* see mk_Int8 comment */ SET_HDR(p, W64zh_con_info, CCS_SYSTEM); - tmp = (unsigned long long*)&(p->payload[0]); + tmp = (ullong*)&(p->payload[0]); *tmp = (StgWord64)w; return p; } @@ -494,19 +494,13 @@ void rts_lock() { #ifdef RTS_SUPPORTS_THREADS - ACQUIRE_LOCK(&sched_mutex); + ACQUIRE_LOCK(&sched_mutex); - // we request to get the capability immediately, in order to - // a) stop other threads from using allocate() - // b) wake the current worker thread from awaitEvent() - // (so that a thread started by rts_eval* will start immediately) - grabReturnCapability(&sched_mutex,&rtsApiCapability); - - // In the RTS hasn't been entered yet, - // start a RTS task. - // If there is already a task available (waiting for the work capability), - // this will do nothing. - startSchedulerTask(); + // we request to get the capability immediately, in order to + // a) stop other threads from using allocate() + // b) wake the current worker thread from awaitEvent() + // (so that a thread started by rts_eval* will start immediately) + waitForReturnCapability(&sched_mutex,&rtsApiCapability); #endif } @@ -514,8 +508,9 @@ void rts_unlock() { #ifdef RTS_SUPPORTS_THREADS - if(rtsApiCapability) + if (rtsApiCapability) { releaseCapability(rtsApiCapability); + } rtsApiCapability = NULL; RELEASE_LOCK(&sched_mutex); #endif