[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

guile and pthreads again

From: Julian Graham
Subject: guile and pthreads again
Date: Wed, 21 Apr 2004 17:16:41 -0400

Hi everyone,
I know this has been addressed several times before, but I haven't been able to find a satisfactory explanation in the docs, mailing list, or newsgroups. I'm using Guile 1.6.4 as an embedded interpreter of user code in a multithreaded (via pthreads) server program I'm writing. I understand that in order to portably examine the stack, Guile must be launched in a stack frame below the ones in which it is used. Will this work in my program, in which I am routinely starting new threads as users connect? It seems like there have been some problems in previous versions that have since been resolved, possibly via the introduction of the scm_spawn_thread function.

I'm a little leary of using it, however, since a) there's no documentation for it as far as I can tell (in general I have a hard time telling whether the documentation is talking about OS threads or Scheme threads); and b) it takes Guile-defined types as arguments and returns a SCM. For what it's worth, I'm not interested (as yet) in threads of Scheme code being launched by Scheme or C code, only in multiple threads of my C code being able to call functions in Guile's C API. It would be okay if I had to lock some kind of Guile mutex in order do this. It would even be okay if each thread had to have its own Guile 'instance', since I'd like to have them evaluate expressions pretty much in isolation from each other.

Finally, provided scm_spawn_thread or some other pthread-replacing code is necessary, how will this play with regular pthread operations, such as joining and cancelling? Will the cancel function for a Guile-aware thread also be Guile-aware so that it can, for example, unprotect a previously GC-protected object? Will the garbage collector then be able to free such memory once the cancel function exits and the thread has been destroyed? Is there a more comprehensive set of documentation, in CVS, maybe, that makes this clearer?

 Apologies if any of this is covered in some obviously place...

Thanks in advance,

From must-see cities to the best beaches, plan a getaway with the Spring
Travel Guide!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]