[PATCH] Re: pthread -- Corinna?

Corinna Vinschen cygwin-patches@cygwin.com
Tue Apr 17 05:05:00 GMT 2001


On Tue, Apr 17, 2001 at 08:30:11PM +1000, Robert Collins wrote:
> From: "Corinna Vinschen" <cygwin-patches@cygwin.com>
> >   So, the better way is probably to drop both ..._sem variables and
> >   just switch off allow_ntsec in read_etc_...() before opening a
> >   file and restoring the setting afterwards.
> >
> >   If that's done inside of the above mentioned mutex or critical
> section
> >   protected area in read_etc_...(), it's protected against changings
> by
> >   simultaneous threads, too.
> 
> is allow_ntsec thread-specific or process-specific or system specific?

It's process-specific. Hmmja, I didn't reflect about that. Sorry.
My first idea (which I didn't write about) was probably better:

When I changed the code in passwd.cc and grp.cc once, I was annoyed
about the usage of fopen in these internal functions. However, I
didn't change it due to the usage of fgets(). I'm pretty sure
it would be better to use CreateFile/ReadFile/CloseHandle in
read_etc_...() than high-level libc functions. This would drop the
need for the ..._sem variables once and for all. No open(), no
ntsec, no recursion. It only would have to care for line endings
by itself.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.



More information about the Cygwin-xfree mailing list