}
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);
*/
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 = g0->threads;
+ g0->threads = tso;
RELEASE_LOCK(&sched_mutex);
- postEvent (cap, EVENT_CREATE_THREAD, tso->id, 0);
+ // ToDo: report the stack size in the event?
+ traceEventCreateThread(cap, tso);
- debugTrace(DEBUG_sched,
- "created thread %ld, stack size = %lx words",
- (long)tso->id, (long)tso->stack_size);
return 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);
+ traceEventThreadWakeup (cap, tso, tso->cap->no);
return next;
}
}
}
+
void
printThreadStatus(StgTSO *t)
{
printAllThreads(void)
{
StgTSO *t, *next;
- nat i, s;
+ nat i, g;
Capability *cap;
# if defined(GRAN)
}
debugBelch("other threads:\n");
- for (s = 0; s < total_steps; s++) {
- for (t = all_steps[s].threads; t != END_TSO_QUEUE; t = next) {
+ for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
+ for (t = generations[g].threads; t != END_TSO_QUEUE; t = next) {
if (t->why_blocked != NotBlocked) {
printThreadStatus(t);
}