[145] in Pthreads mailing list archive

home help back first fref pref prev next nref lref last post

Re: Successes with pthreads and X?

daemon@ATHENA.MIT.EDU (Greg Hudson)
Sun Oct 15 01:43:21 1995

To: "William S. Gribble" <grib@cs.utexas.edu>
Cc: Anselm.Baird_Smith@inria.fr, pthreads@MIT.EDU
In-Reply-To: Your message of "Sat, 14 Oct 1995 21:56:47 CDT."
             <199510150256.VAA23568@cascade.cs.utexas.edu> 
Date: Sat, 14 Oct 1995 23:26:42 EDT
From: Greg Hudson <ghudson@MIT.EDU>

> I had a thought: would it be possible to add a per-thread switch to
> determine if __error() returns the global errno or the thread-local
> one?  That way you could let one thread do all X work, and call
> pthread_use_global_errno() at its startup... or similar.  Any reason
> why it won't work?

If you ever have multiple kernel threads (which MIT pthreads is
planned to support, eventually), maintaining a global errno variable
across context switches won't work.

Binary compatibility with libraries will never quite work.  As such,
it's not a good idea to export a bunch of interfaces to try to make it
work.  However, if you really want to have a thread use the global
errno, you can do:

use_global_errno()
{
#undef errno
	pthread_run->error_p = &errno;
#define errno (* __error())
}


home help back first fref pref prev next nref lref last post