X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FTask.h;h=9b5f0253cd41082c77230991a75a696e25caccdc;hb=6cf8982ac30be6836a0cdd8be5a6ac1a1a144213;hp=3b7a08ee96f63dbb2034b5e5dead40c8acca6991;hpb=cf6b495d8f6d8f08fd6603c5ba2ec7a6acf7ac01;p=ghc-hetmet.git diff --git a/rts/Task.h b/rts/Task.h index 3b7a08e..9b5f025 100644 --- a/rts/Task.h +++ b/rts/Task.h @@ -11,6 +11,8 @@ #include "GetTime.h" +BEGIN_RTS_PRIVATE + /* Definition of a Task -------------------- @@ -20,26 +22,14 @@ Task, and OS threads that enter the Haskell RTS for the purposes of making a call-in are also Tasks. - The relationship between the number of tasks and capabilities, and - the runtime build (-threaded, -smp etc.) is summarised by the - following table: - - build Tasks Capabilities - --------------------------------- - normal 1 1 - -threaded N N + In the THREADED_RTS build, multiple Tasks may all be running + Haskell code simultaneously. A task relinquishes its Capability + when it is asked to evaluate an external (C) call. - The non-threaded build has a single Task and a single global - Capability. - - The THREADED_RTS build allows multiple tasks and mulitple Capabilities. - Multiple Tasks may all be running Haskell code simultaneously. A task - relinquishes its Capability when it is asked to evaluate an external - (C) call. - - In general, there may be multiple Tasks for an OS thread. This - happens if one Task makes a foreign call from Haskell, and - subsequently calls back in to create a new bound thread. + In general, there may be multiple Tasks associated with a given OS + thread. A second Task is created when one Task makes a foreign + call from Haskell, and subsequently calls back in to Haskell, + creating a new bound thread. A particular Task structure can belong to more than one OS thread over its lifetime. This is to avoid creating an unbounded number @@ -169,8 +159,7 @@ extern Task *all_tasks; // Requires: sched_mutex. // void initTaskManager (void); -void stopTaskManager (void); -void freeTaskManager (void); +nat freeTaskManager (void); // Create a new Task for a bound thread // Requires: sched_mutex. @@ -191,7 +180,10 @@ INLINE_HEADER void taskEnter (Task *task); // mainly for stats-gathering purposes. // Requires: sched_mutex. // +#if defined(THREADED_RTS) +// In the non-threaded RTS, tasks never stop. void workerTaskStop (Task *task); +#endif // Record the time spent in this Task. // This is called by workerTaskStop() but not by boundTaskExiting(), @@ -208,12 +200,6 @@ void discardTask (Task *task); // INLINE_HEADER Task *myTask (void); -// After a fork, the tasks are not carried into the child process, so -// we must tell the task manager. -// Requires: sched_mutex. -// -void resetTaskManagerAfterFork (void); - #if defined(THREADED_RTS) // Workers are attached to the supplied Capability. This Capability @@ -275,4 +261,6 @@ taskEnter (Task *task) setMyTask(task); } +END_RTS_PRIVATE + #endif /* TASK_H */