Subject: Re: syslog_r (Re: CVS commit: src/lib/libc)
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: SODA Noriyuki <soda@sra.co.jp>
List: tech-userlevel
Date: 10/28/2006 23:04:48
>>>>> On Sat, 28 Oct 2006 02:01:45 -0400 (EDT),
      der Mouse <mouse@Rodents.Montreal.QC.CA> said:

> In each case, you either lose some aspect of the functionality

That's what I meant. ;-)
i.e. The functionality of async-signal-safe version is usually subset
of the functionality we expect for multithread-safe version and single
thread version.

> or you have to push signal-safe-ness down into the called functionality

This is possible, but requires certain performance degradation,
because every access to the shared resource must be protected by
SIG_BLOCK.  I think most standard functions shouldn't do such things.


In general, it's unreasonable to expect that async-signal-safe version
can do exactly same thing with multithread-safe version.
Of course there are some exceptions even in this point, e.g. strtok_r().

BTW, I don't know any OS which explicitly defines strtok_r() is
async-signal-safe.
-- 
soda