This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: BUG in libstdc++ ... libio ... pthreads
- To: Nathan Myers <ncm@best.com>
- Subject: Re: BUG in libstdc++ ... libio ... pthreads
- From: Andreas Gruenbacher <a.gruenbacher@infosys.tuwien.ac.at>
- Date: Thu, 13 May 1999 21:32:02 +0200
- CC: libstdc++@sourceware.cygnus.com
- Organization: Technical University of Vienna
- References: <199905131841.LAA24384@shell7.ba.best.com>
Nathan Myers wrote:
>
> > The istream input methods seem to contain a bug that causes
> > multithreaded programs to deadlock ...
> > Is this a known problem?
>
> Yes. The library is not thread-safe yet.
The problem is, the file lock bug actually makes it thread-defeating
:-(
What's the benefit of having any file locking code in the library at the
current state?
If you're accessing an I/O class from multiple threads, the only
advantage I see is that the internal data structures of the libio
classes don't get messed up---the output is still interleaved
arbitrarily. In addition, locking/unlocking adds two system calls per
I/O primitive. Since this is expensive, synchronization should at least
be an option to the library user. Do I miss anything?
There is a flag _IO_MTSAFE_IO that determines at library build time
whether or not libio is thread safe. Are there any plans to let the user
decide that at runtime?
Is anybody working on thread safety currently?
-----------------------------------------------------------------------
Andreas Gruenbacher, Vienna University of Technology
a.gruenbacher@infosys.tuwien.ac.at
Contact information: http://www.infosys.tuwien.ac.at/~agruenba