This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Does MT-safe libstdc++ work?
- To: "egcs at cygnus dot com" <egcs at cygnus dot com>
- Subject: Does MT-safe libstdc++ work?
- From: "Andrew Zabolotny" <bit at freya dot etu dot ru>
- Date: Thu, 25 Dec 97 16:08:02 +0400
- Reply-To: "Andrew Zabolotny" <bit at freya dot etu dot ru>
The subject says it all. I've tried to compile a multithread-safe version
of libc++ (particularily libio)
and 1st) encountered a duplicated definition of
static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
in stdstrbuffs.cc, and besides that can't understand how this can work at
all, while, for example:
int
_IO_putc (c, fp)
int c;
_IO_FILE *fp;
{
int result;
CHECK_FILE (fp, EOF);
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile,
fp);
_IO_flockfile (fp);
result = _IO_putc_unlocked (c, fp);
_IO_cleanup_region_end (1);
return result;
}
^^^ If you see, the file is locked with IO_flockfile() and never unlocked.
And there are plenty of other similar places.
What the argument to _IO_cleanup_region_end () means? Is 1 meaning to
invoke cleanup routine before
removing it from cleanup chain and 0 meaning to not do it?
So, my main two questions are:
a) which macros/functions (and how, i.e. in which includes) should I
override/define to make libstdc++ work multithread-safe under my OS
(OS/2).
b) should I do it at all, if the file functions in libc (i.e. open(),
write() etc) which libio uses *are* thread-safe?
Greetings,
_\ndy@teamOS/2