This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa mudflap] per-thread items



On Saturday, May 17, 2003, at 10:19 AM, Eyal Lebedinsky wrote:
Nevertheless, and as I should hit the bed now, is it possible
that 'errno' is allocated for each thread and as such it cannot
be registered once only at the start of the run? If so, does
the current code handle this?


Absolutely. Mac OS X/Darwin has the following in <sys/errno.h>

extern int * __error __P((void));
#define errno (*__error())

From the Darwin source:

#undef errno
extern int errno;
int *__error(void) {
pthread_t self = pthread_self();
/* If we're not a detached pthread, just return the global errno */
if ((self == (pthread_t)0) || (self->sig != _PTHREAD_SIG) || (self->detached & _PTHREAD_CREATE_PARENT)) {
return &errno;
}
return &self->err_no;
}



-tim



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]