diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-07-06 11:07:03 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2019-07-06 11:09:06 -0400 |
commit | 8bd87181c769581fa487ba12e8d5c2445b73d1cf (patch) | |
tree | 1080ec8c017bbb124522474e51daafd2b459045e | |
parent | a0db5c5cf57eecaabce15f7c33abf5db759cff40 (diff) | |
download | haskell-wip/expose-task.tar.gz |
rts: Expose Taskwip/expose-task
-rw-r--r-- | includes/Rts.h | 1 | ||||
-rw-r--r-- | includes/rts/Task.h | 40 | ||||
-rw-r--r-- | rts/Task.h | 23 |
3 files changed, 41 insertions, 23 deletions
diff --git a/includes/Rts.h b/includes/Rts.h index dd60726c39..e9c13b6b3b 100644 --- a/includes/Rts.h +++ b/includes/Rts.h @@ -210,6 +210,7 @@ void _assertFail(const char *filename, unsigned int linenum) #include "rts/Globals.h" #include "rts/IOManager.h" #include "rts/Linker.h" +#include "rts/Task.h" #include "rts/Ticky.h" #include "rts/Timer.h" #include "rts/StablePtr.h" diff --git a/includes/rts/Task.h b/includes/rts/Task.h new file mode 100644 index 0000000000..d8fe440823 --- /dev/null +++ b/includes/rts/Task.h @@ -0,0 +1,40 @@ +/* ----------------------------------------------------------------------------- + * + * (c) The GHC Team, 1998-2009 + * + * Task API + * + * Do not #include this file directly: #include "Rts.h" instead. + * + * To understand the structure of the RTS headers, see the wiki: + * https://gitlab.haskell.org/ghc/ghc/wikis/commentary/source-tree/includes + * + * -------------------------------------------------------------------------- */ + +#pragma once + +typedef struct Task_ Task; + +// Create a new Task for a bound thread. This Task must be released +// by calling boundTaskExiting. The Task is cached in +// thread-local storage and will remain even after boundTaskExiting() +// has been called; to free the memory, see freeMyTask(). +// +Task* newBoundTask (void); + +// Return the current OS thread's Task, which is created if it doesn't already +// exist. After you have finished using RTS APIs, you should call freeMyTask() +// to release this thread's Task. +Task* getTask (void); + +// The current task is a bound task that is exiting. +// +void boundTaskExiting (Task *task); + +// Free a Task if one was previously allocated by newBoundTask(). +// This is not necessary unless the thread that called newBoundTask() +// will be exiting, or if this thread has finished calling Haskell +// functions. +// +void freeMyTask(void); + diff --git a/rts/Task.h b/rts/Task.h index 88b567ab87..c0002c9360 100644 --- a/rts/Task.h +++ b/rts/Task.h @@ -200,29 +200,6 @@ extern Mutex all_tasks_mutex; void initTaskManager (void); uint32_t freeTaskManager (void); -// Create a new Task for a bound thread. This Task must be released -// by calling boundTaskExiting. The Task is cached in -// thread-local storage and will remain even after boundTaskExiting() -// has been called; to free the memory, see freeMyTask(). -// -Task* newBoundTask (void); - -// Return the current OS thread's Task, which is created if it doesn't already -// exist. After you have finished using RTS APIs, you should call freeMyTask() -// to release this thread's Task. -Task* getTask (void); - -// The current task is a bound task that is exiting. -// -void boundTaskExiting (Task *task); - -// Free a Task if one was previously allocated by newBoundTask(). -// This is not necessary unless the thread that called newBoundTask() -// will be exiting, or if this thread has finished calling Haskell -// functions. -// -void freeMyTask(void); - // Notify the task manager that a task has stopped. This is used // mainly for stats-gathering purposes. // Requires: sched_mutex. |