Subject: Re: pthreads plan
To: Todd Vierling <tv@pobox.com>
From: Greg Hudson <ghudson@MIT.EDU>
List: tech-userlevel
Date: 11/06/1999 22:54:47
Todd wrote:
>>> Support questions or not, just tell people "set _REENTRANT... the
>>> pthread man pages tell you to do so."

I responded:
>> And if they want to use a third-party library like Motif, tell them
>> they're screwed?

Todd responded:
> Thread safety is much more than compiling the libraries you use with
> _REENTRANT.  MT-safe code requires a knowledge of function
> reentrancy, and implementation of same, to work correctly.

Sure, so you assume that the Motif library isn't thread-safe, and you
wrap a mutex around all calls into that library.  If only one thread
is in that library at a time, and a few other precautions, you can be
safe.

But not if the Motif library won't work together with code compiled
_REENTRANT.  And not if the Motif library uses unlocked getc and putc
macros to write to the same file handles as your application.  (Which
might not be a problem in all cases, but it would be good if it could
be made to work.)