This is the mail archive of the guile@cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Linux pthreads and Guile COOP threads


On Sat, Jul 10, 1999 at 06:34:21PM -0500, Jim Blandy wrote:
> 
> The LinuxThreads implementation of pthreads is completely wedded to
> the identification of stacks with threads.  Each thread (except the
> initial one) gets a block of stack aligned so that, if you round up
> your stack pointer, you'll get a pointer to the thread's structure.
> 
> I don't think you can mix COOP threads and LinuxThreads unless you
> can arrange to switch back to the main stack every time a LinuxThreads
> function might be called.

I did this some time last fall for some load balancing software.
Maybe I was just lucky and somehow didn't notice weirdness, but it
seemed to work (ran for weeks without crashing, seemed to give about
the right results).  you can find the source at
http://msc.tamu.edu/erik/stuff/bonfire-1.0.tar.gz

The trick was to do the gh_enter() before creating any threads.  It
would give you a real quick segfault if you made another thread before
starting guile.

be warned.  the source is just an archive I made when the project
finished.  it's not polished for distribution, or documented.  (check
main.c for what I did starting up the threads, guile stuff in
balance.[ch])

Erik

-- 
steadfastly refusing to acknowledge the existence of objective reality.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]