[omniORB] Possible bug.

Tom Haggie THaggie@img.seagatesoftware.com
Thu, 23 Apr 1998 03:49:56 -0700


Hiya,
	We've been having problems stopping the threads in our thread pool on 
program termination, this is because TlsGetValue is returning NULL in
the method 
below, so a fatal error is thrown.

	As there is no error returned by GetLastError I have added the 
"&& GetLastError()" to stop our code falling over. Is this reasonable or
will it bite 
us somewhere later? 

	What we're doing is asking each thread  to go away and then joining in 
turn to clean up the storage, if we're in a separate thread to the
unloading of 
the DLL we don't get an error.

-*TOM*-

omni_thread*
omni_thread::self(void)
{
    LPVOID me;

    me = TlsGetValue(self_tls_index);

    if (me == NULL && GetLastError()) { /* && GetLastError() added by me
*/
		throw omni_thread_fatal(GetLastError());
	}

    return (omni_thread*)me;
}