From: ali@asterix.hi.Com (Shaheen Ali)
Subject: Re: Threads
Date: 1995/04/19 [thread overview]
Message-ID: <ALI.95Apr19123943@asterix.hi.Com> (raw)
In-Reply-To: 1995Apr11.170345.14566@decvax.dec.com
"Jeffrey" == Jeffrey M Denham <denham@denham.zk3.dec.com> writes:
In article <1995Apr11.170345.14566@decvax.dec.com> denham@denham.zk3.dec.com (Jeffrey M. Denham) writes:
[...Alot of stuff I deleted. Basically, Dan Reynolds wants to know
what to do about two different errno's in a library or a binary...]
Jeffrey> Here's a reply from a DECthreads developer who hasn't had
Jeffrey> time to monitor the newsgroup lately:
Jeffrey> That's simply untrue! DECthreads and libc_r do write the
Jeffrey> global "int errno" when they report an error, but that's
Jeffrey> strictly secondary and only for compatibility with code
Jeffrey> that's not built using _REENTRANT. They ALSO set a per-thread
Jeffrey> errno, and that's what all code should be reading when using
Jeffrey> thread-safe libraries.
While everything that this engineer writes is true there is an
underlying assumption that ALL libraries linked against a thread
consuming application are thread safe. Notice, that MT programs
should not link against libc.a, but rather against libc_r.a.
This is absolutely necessary. All libraries, .o's, shared libraries
and all binaries (crt0.o and mcrt0.o) should be libsafe if the program
is multithreaded. Not following this guideline puts the program at risk
of fetching the wrong errno.
In the simple case of linking foo.c to the proper thread library
should be handled by the compiler. Sometimes, the compiler cannot do
this. In this case, the user should guard his makefiles against
including non-threadsafe, non-reentrant libraries.
If you link a multithreaded program against libX or libXt, I am pretty
sure that these will pass errno in the thread-deadly global variable.
The results are sure to be crazy. DEC may be kind enough to provide
thread-safe versions of these libraries. In that case, be sure that
your multithreaded program is using them.
Shaheen
--
--
"They're gone, buddy. But, look at the bright side: They're GONE, buddy!"
-- The Cat, _Red Dwarf_
Shaheen H. Ali, Hitachi Computer Products, Waltham, MA
ali@hi.com, [ space left blank due to unsolicited advice ]
work phone: (617) 890 0444, fax: (617) 890 4998
PGP fingerprint = 9C B1 FB F2 A5 62 64 C1 CB 6A E6 3A 86 B0 A4 B7
next prev parent reply other threads:[~1995-04-19 4:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-04-03 4:00 Threads Dan Reynolds
1995-04-06 4:00 ` Threads Spider Boardman
1995-04-11 4:00 ` Threads Jeffrey M. Denham
1995-04-19 4:00 ` Shaheen Ali [this message]
-- strict thread matches above, loose matches on Subject: below --
1994-11-28 16:19 threads ron harter
1994-11-29 21:56 ` threads Jay R. Talbott
1994-08-03 21:05 threads Lawrence A. Palmer
1994-08-03 23:22 ` threads Matt Thomas
1994-08-04 1:05 ` threads Sinan Karasu
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox