On Dec 7, 2004, at 9:25 PM, Andrew Savige wrote:

/* Horrible hacky thread-unsafe version but no XX -------- */
...
static const char* g_file;
static unsigned long g_line;

i forgot to mention, the way around the non-thread-safety here is to use thread-local storage.
c.f. pthread_key_create() and pthread_getspecific().


for a similarly evil trick, the GNU C library defines the global errno like this:

/* function that fetches the address of the calling thread's errno from TLS */
int * __get_errno_address (void);


   #define errno  (*__get_errno_address())


--
He's so good, you're gonna rock, and if you don't rock, it's your own fault.
-- kk, describing the perks of having a very good drummer.




Reply via email to