[GHC] #9656: Process and thread init/deinit hooks for C libraries
GHC
ghc-devs at haskell.org
Thu Oct 2 13:22:12 UTC 2014
#9656: Process and thread init/deinit hooks for C libraries
-------------------------------------+-------------------------------------
Reporter: 3noch | Owner:
Type: feature | Status: closed
request | Milestone:
Priority: normal | Version: 7.8.3
Component: Compiler | Keywords: FFI
Resolution: invalid | Architecture: Unknown/Multiple
Operating System: | Difficulty: Unknown
Unknown/Multiple | Blocked By:
Type of failure: | Related Tickets:
None/Unknown |
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by AndreasVoellmy):
(Let me know if this discussion has moved elsewhere.)
I've wondered about this question, too. I have a multithreaded Haskell
program that makes some calls into a JVM. To do this, each OS thread
calling into the JVM needs to have some data initialized. While I could do
the forkOS approach, I want to have any Haskell thread call into Java,
rather than having to send a message to my forkOS'd Haskell thread, wait
for it to be scheduled, have it do the call, send a message back, etc. One
idea is to have a capability-local data structure, but that doesn't work
because multiple OS threads might execute a capability (at different
times). So I have to manage the initialization in the C code: whenever the
C code is invoked in a given OS thread, the thread checks whether its data
structures are initialized.
No conclusions here, just wanted to chime with my experience on this
topic.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9656#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list