possible workaround for unreproducable race during borland dll rundown

This commit is contained in:
Jeff Hill
2003-03-19 23:18:28 +00:00
parent 12e884b433
commit 63b588defb
+24 -1
View File
@@ -120,16 +120,18 @@ static void threadCleanupWIN32 ( void )
win32ThreadParam * pParm;
WaitForSingleObject ( win32ThreadGlobalMutex, INFINITE );
while ( pParm = ( win32ThreadParam * ) ellFirst ( & threadList ) ) {
epicsParmCleanupWIN32 ( pParm );
}
ReleaseMutex ( win32ThreadGlobalMutex );
if ( tlsIndexThreadLibraryEPICS != 0xFFFFFFFF ) {
TlsFree ( tlsIndexThreadLibraryEPICS );
tlsIndexThreadLibraryEPICS = 0xFFFFFFFF;
}
ReleaseMutex ( win32ThreadGlobalMutex );
if ( win32ThreadGlobalMutex ) {
CloseHandle ( win32ThreadGlobalMutex );
win32ThreadGlobalMutex = NULL;
@@ -735,6 +737,27 @@ epicsShareFunc void epicsShareAPI epicsThreadSleep ( double seconds )
Sleep ( milliSecDelay );
}
/*
* epicsThreadGetIdSelf ()
*/
double epicsShareAPI epicsThreadSleepQuantum ()
{
static const double secPerTick = 100e-9;
DWORD adjustment;
DWORD delay;
BOOL disabled;
BOOL success;
success = GetSystemTimeAdjustment (
& adjustment, & delay, & disabled );
if ( success ) {
return delay * secPerTick;
}
else {
return 0.0;
}
}
/*
* epicsThreadGetIdSelf ()
*/