X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FThreads.c;h=9867c1c50e0cccf5bfba1508899c8ab66f8177c0;hb=35beb255958545f401f4f2229953a6355d09476c;hp=8318e28ca9236e95fbc649ae38da11e97bea3d2d;hpb=c5cafbcca54c4b1117bc43b31d86afa583fb7f62;p=ghc-hetmet.git diff --git a/rts/Threads.c b/rts/Threads.c index 8318e28..9867c1c 100644 --- a/rts/Threads.c +++ b/rts/Threads.c @@ -63,7 +63,7 @@ createThread(Capability *cap, nat size) } size = round_to_mblocks(size); - tso = (StgTSO *)allocateLocal(cap, size); + tso = (StgTSO *)allocate(cap, size); stack_size = size - TSO_STRUCT_SIZEW; TICK_ALLOC_TSO(stack_size, 0); @@ -102,15 +102,13 @@ createThread(Capability *cap, nat size) */ ACQUIRE_LOCK(&sched_mutex); tso->id = next_thread_id++; // while we have the mutex - tso->global_link = g0s0->threads; - g0s0->threads = tso; + tso->global_link = cap->r.rNursery->threads; + cap->r.rNursery->threads = tso; RELEASE_LOCK(&sched_mutex); - postEvent (cap, EVENT_CREATE_THREAD, tso->id, 0); + // ToDo: report the stack size in the event? + traceSchedEvent (cap, EVENT_CREATE_THREAD, tso, tso->stack_size); - debugTrace(DEBUG_sched, - "created thread %ld, stack size = %lx words", - (long)tso->id, (long)tso->stack_size); return tso; } @@ -256,10 +254,7 @@ unblockOne_ (Capability *cap, StgTSO *tso, cap->context_switch = 1; #endif - postEvent (cap, EVENT_THREAD_WAKEUP, tso->id, tso->cap->no); - - debugTrace(DEBUG_sched, "waking up thread %ld on cap %d", - (long)tso->id, tso->cap->no); + traceSchedEvent (cap, EVENT_THREAD_WAKEUP, tso, tso->cap->no); return next; } @@ -357,6 +352,7 @@ printThreadBlockage(StgTSO *tso) } } + void printThreadStatus(StgTSO *t) {