WIN32 remove atexit cleanup of TLS

Force cleanup of resource for threads which may
still be running opens the possibility of strange
race conditions.  Like threads be erroneously
detected as non-epics.

Doing this cleanup at process exit serves no real
purpose.  This code might be valid to re-add
in a DLL exit handler.
This commit is contained in:
Michael Davidsaver
2019-09-24 20:21:56 -07:00
parent f134abb84e
commit b68f47927c
@@ -37,7 +37,6 @@
epicsShareFunc void osdThreadHooksRun(epicsThreadId id);
void setThreadName ( DWORD dwThreadID, LPCSTR szThreadName );
static void threadCleanupWIN32 ( void );
typedef struct win32ThreadGlobal {
CRITICAL_SECTION mutex;
@@ -218,15 +217,6 @@ static win32ThreadGlobal * fetchWin32ThreadGlobal ( void )
return 0;
}
crtlStatus = atexit ( threadCleanupWIN32 );
if ( crtlStatus ) {
TlsFree ( pWin32ThreadGlobal->tlsIndexThreadLibraryEPICS );
DeleteCriticalSection ( & pWin32ThreadGlobal->mutex );
free ( pWin32ThreadGlobal );
pWin32ThreadGlobal = 0;
return 0;
}
InterlockedExchange ( & initCompleted, 1 );
return pWin32ThreadGlobal;
@@ -254,25 +244,6 @@ static void epicsParmCleanupWIN32 ( win32ThreadParam * pParm )
}
}
/*
* threadCleanupWIN32 ()
*/
static void threadCleanupWIN32 ( void )
{
win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal ();
win32ThreadParam * pParm;
if ( ! pGbl ) {
fprintf ( stderr, "threadCleanupWIN32: unable to find ctx\n" );
return;
}
while ( ( pParm = ( win32ThreadParam * )
ellFirst ( & pGbl->threadList ) ) ) {
epicsParmCleanupWIN32 ( pParm );
}
}
/*
* epicsThreadExitMain ()
*/