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

Re: Multithreading?





On Sat, 12 Feb 2000, Matthew Flatt wrote:

> Compiled in the normal way, MzScheme cannot be called from multiple
> threads at once. But if a multi-threaded C++ app calls MzScheme
> functions from only one thread at a time, and only that thread's stack
> points to GCable objects, then everything's fine (modulo a Windows GC
> problem described below).

Okay ... how about this: I encapsulate all access to MzScheme in a single
thread, and pass thunks to it over a producer-consumer queue. The thunks
then get launched by the MzScheme-manager thread using scheme_thread. Does
this seem relatively logical?

> For a few OSes, MzScheme can also be compiled to use OS-defined threads
> for Scheme threads, and in that case it can be called from multiple
> threads at once --- but only if MzScheme itself created the threads via
> scheme_thread(). Because of the scheme_thread() restriction, it's not a
> solution for all applications.

We're strictly UNIX, and all our platforms have pthreads, so in principle 
that's a workable possibility. However, the main system architecture is
using a licensed thread library. If scheme_thread could tack all the GC
management stuff on top of that we'd have a winner. However, the LGPL
won't let me do that.

Thanks for any other infos.


--Chris