[GHC] #13554: Allow the user to provide a C function that is called on each thread the RTS creates before running any Haskell code
GHC
ghc-devs at haskell.org
Fri Sep 29 15:22:36 UTC 2017
#13554: Allow the user to provide a C function that is called on each thread the
RTS creates before running any Haskell code
-------------------------------------+-------------------------------------
Reporter: dobenour | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone: 8.4.1
Component: Runtime System | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by fendor):
Hi,
As an API proposal:
{{{
data ThreadCallbackHandle
data ThreadCallbacks =
ThreadCallbacks
{ threadCreationCb :: IO ()
, threadDestructionCb :: IO ()
}
-- function calls would be blocking until
-- the callbacks have been executed on all threads.
registerCallbacks :: ThreadCallbacks -> IO ThreadCallbackHandle
unregisterCallbacks :: ThreadCallbackHandle -> IO ()
}}}
In this proposal, one can submit callbacks that are executed on thread
creation or thread termination.
These callbacks are also executed on every thread that is currently being
executed, since it seems impossible to guarantee that no code execution
migrates to threads that have not executed the callback functions.
When registering new callbacks, the function should block, until it is
guaranteed that every thread has executed the new callback function.
Several calls to this function should save existing callbacks and execute
all callback functions that have been supplied upon thread creation and
termination.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13554#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list