[gambit-list] Calling Scheme code from different OS threads

James Long longster at gmail.com
Sun Feb 25 03:11:40 EST 2007


I need the ability to create OS threads because of the blocking nature of
the c calls (mainly with c functions that do network stuff).  I ended up
wrapping up boost's excellent thread library in c functions (everything is
compiled as c++ now because it's a c++ library, which should be fine) to
maintain cross-platform-ness.  The resulting interface is clean and simple
and it works great.

I noticed what should have been an expected result, however, and I'm
interested in exactly what's going on.  When I call a scheme function from
my created OS thread, the process crashes if it does anything with I/O or
anything more complex than an if/then statement.  My example app crashed
when I tried to call 'display' from the OS thread.

I know that we are entering Scheme totally outside of it's threading system,
which means it's probably accessing memory that it normally wouldn't be
allowed to.  Is it just a result of Gambit using shared memory often, so two
executions of Gambit code corrupt each other?  Again, I'll usually use the
OS threads to only call C code so this isn't a problem, but I was just
curious about the internal workings of Gambit (and possibly if it will
support OS threads in the future?  or is that Termite?)

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20070225/6af2195d/attachment.htm>


More information about the Gambit-list mailing list