}
#endif
+ postEvent (cap, EVENT_CREATE_THREAD, tso->id, 0);
+
#if defined(GRAN)
debugTrace(GRAN_DEBUG_pri,
"==__ schedule: Created TSO %d (%p);",
ASSERT(tso->bound->cap == tso->cap);
tso->bound->cap = cap;
}
+
tso->cap = cap;
appendToRunQueue(cap,tso);
- // we're holding a newly woken thread, make sure we context switch
- // quickly so we can migrate it if necessary.
- context_switch = 1;
+
+ // context-switch soonish so we can migrate the new thread if
+ // necessary. NB. not contextSwitchCapability(cap), which would
+ // force a context switch immediately.
+ cap->context_switch = 1;
} else {
// we'll try to wake it up on the Capability it was last on.
wakeupThreadOnCapability(cap, tso->cap, tso);
}
#else
appendToRunQueue(cap,tso);
- context_switch = 1;
+
+ // context-switch soonish so we can migrate the new thread if
+ // necessary. NB. not contextSwitchCapability(cap), which would
+ // force a context switch immediately.
+ cap->context_switch = 1;
#endif
- debugTrace(DEBUG_sched,
- "waking up thread %ld on cap %d",
+ 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);
return next;
default:
printThreadBlockage(t);
}
+ if (t->flags & TSO_DIRTY) {
+ debugBelch(" (TSO_DIRTY)");
+ } else if (t->flags & TSO_LINK_DIRTY) {
+ debugBelch(" (TSO_LINK_DIRTY)");
+ }
debugBelch("\n");
}
}