summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9e78087)
patch up forkProcess(): don't discard our own Task, and set
cap->spare_workers to be empty in the child process.
)
{
#ifdef FORKPROCESS_PRIMOP_SUPPORTED
)
{
#ifdef FORKPROCESS_PRIMOP_SUPPORTED
pid_t pid;
StgTSO* t,*next;
pid_t pid;
StgTSO* t,*next;
Capability *cap;
IF_DEBUG(scheduler,sched_belch("forking!"));
Capability *cap;
IF_DEBUG(scheduler,sched_belch("forking!"));
deleteThreadImmediately(cap,t);
}
deleteThreadImmediately(cap,t);
}
- // wipe the main thread list
- while ((task = all_tasks) != NULL) {
- all_tasks = task->all_link;
- discardTask(task);
+ // wipe the task list
+ ACQUIRE_LOCK(&sched_mutex);
+ for (task = all_tasks; task != NULL; task=task->all_link) {
+ if (task != cap->running_task) discardTask(task);
+ RELEASE_LOCK(&sched_mutex);
+
+ // wipe our spare workers list.
+ cap->spare_workers = NULL;
+
cap = rts_evalStableIO(cap, entry, NULL); // run the action
rts_checkSchedStatus("forkProcess",cap);
cap = rts_evalStableIO(cap, entry, NULL); // run the action
rts_checkSchedStatus("forkProcess",cap);