|thread safe lexer (flex?) email@example.com (Josh N. Pritikin) (1992-06-13)|
|Re: thread safe lexer (flex?) firstname.lastname@example.org (Josh N. Pritikin) (1992-06-14)|
|From:||"Josh N. Pritikin" <email@example.com>|
|Date:||Sun, 14 Jun 1992 05:25:48 GMT|
> [Is there a version of lex that makes reentrant lexers? ]
> [Is there a reentrant stdio that a reentrant lex could call to read its
> input? -John]
Reentrant stdio is irrelivant to my question since I'm reading from a
string. All that I need is a thread-safe lexer. To actually make a lexer
reentrant, you would have to collect all the globals into a structure and
pass that as a parameter to every lexer function - YUK! A more attractive
alternative is to get the globals from the threads library (all thread
libraries support a way of associating memory with a specific thread.)
Stdio is already reentrant - all the state for a file is kept in FILE's.
Its just not thread-safe since the buffers aren't protected by mutex
locks. Correct? Michael Jones (firstname.lastname@example.org) has done some preliminary
work on making libc threads-safe.
BTW, I've been working on a stdio redesign that emphisizes threads. One
can do all kinds of nifty things with tcp sockets: one thread can block on
read for rpcs while other threads occationally write to the same socket.
It makes servers much more flexible to work with. Closing a socket is a
bit tricky though.
( Josh Pritikin email@example.com
Return to the
Search the comp.compilers archives again.