FFI, safe vs unsafe

Bulat Ziganshin bulat.ziganshin at gmail.com
Sat Apr 1 05:30:30 EST 2006


Hello John,

Saturday, April 1, 2006, 4:53:00 AM, you wrote:

>> In an implementation which runs more than one Haskell thread inside
>> one OS thread, like ghc without -threaded or hugs, the threads are  
>> NOT completely independent, because they share one C stack. So while  

> no, state-threads, a la NSPR, state-threads.sf.net, or any other of a
> bunch of implementations.

> each thread has its own stack, you 'longjmp' between them. it can almost
> practically be done in portable C except the mallocing of the new stack,

new stacks can be allocated by alloca() calls. all these
alloca-allocated stack segments can be used as pool of stacks assigned
to the forked threads. although i don't tried this, my own library
also used processor-specific method.

i planned to suggest this to the ghc-via-C compilation we are
discussed on February. it's great that the libs already exists. why
you don't implement this himself, at least in cooperative (yield-driven)
manner?


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-prime mailing list