Re: thread safe?

Bruce Butterfield <bab-lsrMmtCsshhWk0Htik3J/[email protected]> Thu, 11 Dec 2003 11:56:50 -0800
Newsgroups gmane.lisp.scheme.ssax-sxml
Message-ID <[email protected]>
I will provide a small sample as soon as I can get to it but here is a 
bit more information. I'm using PLT version 205 (Kiril's port of SSAX). 
I'm using the PLT-specific thread library which is pretty solid; the 
production system works as a socket-based client/server with the PLT 
system acting as an XML processor listening on a socket; a connect from 
the data source spawns a new socket which is then passed to a new thread 
having it's own input/output ports. This thread uses SSAX:make-parser to 
do the work.

I'm fairly convinced that it is pilot error at this point but I've tried 
to reduce my code footprint to a minimum and I still see the problem.

I'm not sure how the threads could not have their own distinct input (or 
output) ports given this scenario but I will explore that possibility 
further.

Thanks for replying; I'm going to try to put that example together for 
you later today.

[email protected] wrote:
> Hello!
> 
> 
>>I'm wondering if there are any obvious pitfalls -- first prototype
>>doesn't look good (seeds getting stomped on, etc.),
> 
> 
> One has to be careful with the input port. The port is considered as a
> linearly updateable datum. So, two different instances of SSAX in two
> different threads must have their own, separately created, input port
> (even both ports eventually refer to the same file). We also should
> make sure that just reading from ports is thread-safe. As I recall, it
> is safe on Gambit. Of course it depends what kind of thread system we
> deal with: implemented by a particular Scheme system or POSIX
> threads. In the latter case, we should make sure that the whole i/o
> library (libc) is thread-safe and the Scheme run-time is compiled with
> thread-safe system libraries.
> 
> The seeds in SSAX are treated _explicitly_ as linear parameters -- this
> is as thread-safe as one can possibly get. 
> 
> If it is possible to provide some details (or a small representative
> example), it would help to analyze the problem further.
> 
> 	Cheers,
> 	Oleg


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click