/* -----------------------------------------------------------------------------
- * $Id: PrimOps.hc,v 1.108 2003/07/03 15:14:58 sof Exp $
+ * $Id: PrimOps.hc,v 1.113 2003/09/21 22:20:55 wolfgang Exp $
*
* (c) The GHC Team, 1998-2002
*
#define PUSHED(m) Sp -= (m); JMP_(ENTRY_CODE(Sp[m]));
# define RET_P(a) PUSH(1,a); PUSHED(1)
-# define RET_N(a) PUSH(1,a); PUSHED(2)
+# define RET_N(a) PUSH(1,a); PUSHED(1)
# define RET_PP(a,b) PUSH(2,a); PUSH(1,b); PUSHED(2)
# define RET_NN(a,b) PUSH(2,a); PUSH(1,b); PUSHED(2)
FE_
}
+FN_(isCurrentThreadBoundzh_fast)
+{
+ /* no args */
+ I_ r;
+ FB_
+ r = (I_)(RET_STGCALL1(StgBool, isThreadBound, CurrentTSO));
+ RET_N(r);
+ FE_
+}
/* -----------------------------------------------------------------------------
* MVar primitives
nat target;
#endif
FB_
- /* args: R1.i */
+ /* args: R1.i (microsecond delay amount) */
ASSERT(CurrentTSO->why_blocked == NotBlocked);
CurrentTSO->why_blocked = BlockedOnDelay;
ACQUIRE_LOCK(&sched_mutex);
#ifdef mingw32_TARGET_OS
/* could probably allocate this on the heap instead */
- ares = (StgAsyncIOResult*)RET_STGCALL2(P_,stgMallocBytes,sizeof(StgAsyncIOResult), "asyncWritezh_fast");
+ ares = (StgAsyncIOResult*)RET_STGCALL2(P_,stgMallocBytes,sizeof(StgAsyncIOResult), "delayzh_fast");
reqID = RET_STGCALL1(W_,addDelayRequest,R1.i);
ares->reqID = reqID;
ares->len = 0;
ares->errCode = 0;
CurrentTSO->block_info.async_result = ares;
+ /* Having all async-blocked threads reside on the blocked_queue simplifies matters, so
+ * change the status to OnDoProc & put the delayed thread on the blocked_queue.
+ */
+ CurrentTSO->why_blocked = BlockedOnDoProc;
APPEND_TO_BLOCKED_QUEUE(CurrentTSO);
#else
target = (R1.i / (TICK_MILLISECS*1000)) + getourtimeofday();
FE_
}
#endif
+