FFI, safe vs unsafe

John Meacham john at repetae.net
Mon Apr 3 04:53:05 EDT 2006


On Sat, Apr 01, 2006 at 02:30:30PM +0400, Bulat Ziganshin wrote:
> 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.

so you alloca new big areas and then use 'longjmp' to jump back and
forth within the same stack simulating many stacks?

that is a neat trick. will confuse the hell out of the bohem garbage
collector but I don't want to rely on that much longer anyway :)

however, it would be a good thing to fall back to if no processor
specific stack creation routine is available.

this minimal threads library 
http://www.cs.uiowa.edu/%7Ejones/opsys/threads/
uses an interesting trick where it probes the setjmp structure to find
the SP reasonably portably on any stack-based architecture. pretty
clever.

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Haskell-prime mailing list