Mail Archives: djgpp-workers/2005/01/02/07:41:11
Hello.
Eli Zaretskii wrote:
>>Date: Sat, 01 Jan 2005 09:27:08 -0700
>>From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
[snip]
>>I don't think we need to worry explicitly about threads within these
>>functions.
>
>
> ??? Then why do we need to have reentrant functions? We could simply
> provide a wrapper around the old code with the signature required by
> Posix.
Regarding reentrancy vs. threading, SUSv3 says this for strtok():
"The strtok() function need not be reentrant. A function that is not
required to be reentrant is not required to be thread-safe."
So we could ignore threads.
strtok_r() is more generally useful. I find it irritating occasionally
that you can only use strtok() on one string at a time. strtok_r()
removes this restriction. It will save people implementing your own
re-entrant strtok(). I can't really comment on the other *_r()
functions, though.
We can make the non-reentrant functions thread-safe. Is it worth it?
Functionally having a thread-safe strtok() seems a little pointless. It
may be worthwhile to save the people implementing thread libraries some
work. E.g.: For strtok(), we'd put a mutex around it, and stub out the
mutex functions.
Bye, Rich =]
--
Richard Dawe [ http://homepages.nildram.co.uk/~phekda/richdawe/ ]
"You can't evaluate a man by logic alone."
-- McCoy, "I, Mudd", Star Trek
- Raw text -