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: Guile in C-threads


Oskar Linde <d98-oli@nada.kth.se> writes:

> I've got a threaded C program and I want to be able to run a scheme
> script in each of the threads. The easiest way to do this would be
> to start a guile environment in each thread (gh_enter ()), but since
> the threads share all global data, this seems impossible.

I've got a similar problem.

> Can guile store its environment in an object, so each thread can run
> its own instance of the guile interpreter or can all threads share
> the same guile environment, but run the scripts as separate scheme
> threads?

Excellent question.  I think it is possible but difficult to make this
change to guile.  For each global and file static variable that guile
uses, we would need to make a change.  Each change would either put the
state variable into a per-interpreter structure, or put a mutex around
accesses of the state variable, depending on which is the right semantics.

So this is not a trivial task.  I could also use this change, but I
haven't tackled it for lack of enthusiasm.

-russ

--
The early bird gets the worm, but the second mouse gets the cheese.