Re: thread safe lexer (flex?)

"Josh N. Pritikin" <jpab+@andrew.cmu.edu>
Sun, 14 Jun 1992 05:25:48 GMT

          From comp.compilers

Related articles
thread safe lexer (flex?) jpab+@andrew.cmu.edu (Josh N. Pritikin) (1992-06-13)
Re: thread safe lexer (flex?) jpab+@andrew.cmu.edu (Josh N. Pritikin) (1992-06-14)
| List of all articles for this month |
Newsgroups: comp.compilers
From: "Josh N. Pritikin" <jpab+@andrew.cmu.edu>
Keywords: lex, parallel
Organization: Compilers Central
References: 92-06-052
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 (mbj@cs.cmu.edu) 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.


joshp


( Josh Pritikin joshp+@cmu.edu
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.