This is the mail archive of the
cygwin-xfree@cygwin.com
mailing list for the Cygwin XFree86 project.
Re: [PATCH] Re: pthread -- Corinna?
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.