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

Re: Multithreading?



Quoting ender:
> 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?

I can't see any problem with that.

> > 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.

I don't understand. You'd have to add a little code to MzScheme so it
calls the right thread library procedures, and you'd also have to
change the GC (which is probably the hard part). No problems there.

You'd have to make your MzScheme changes publicly available (probably
40 lines of code, or so) --- but that's all.

Matthew