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: thread local variables


> I've been reading up on MzScheme's handling of thread local variables,
> and they have a very neat system.

One problem is that this is inconsistent with the getter/setter
paradigm we argued over a while ago.  Rather than:
	(current-output-port)
	(current-output-port P);  MzScheme - set (current-output-port) to P
the plan is to do:
	(current-output-port)
	(set! (current-output-port) P)

My preferred solution for thread-local variables is a thread-safe
version of fluid-let:

Syntax: fluid-let ((VARIABLE INIT) ...) BODY ... 
     Evaluate the INIT expressions. Then modify the dynamic bindings for
     the VARIABLES to the values of the INIT expressions, and evaluate
     the BODY expressions. Return the result of the last expression in BODY.
     Before returning, restore the original bindings. The temporary bindings
     are only visible in the current thread, and its descendent threads.

	--Per Bothner
Cygnus Solutions     bothner@cygnus.com     http://www.cygnus.com/~bothner