From b6e0dbaec7749bfff63d395dcdba4ada2a0bc4d9 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Thu, 15 Jan 2004 23:24:08 +0000 Subject: [PATCH] cleanned up win32 thread entry --- src/libCom/osi/os/WIN32/osdThread.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/libCom/osi/os/WIN32/osdThread.c b/src/libCom/osi/os/WIN32/osdThread.c index 96d344603..edea368b0 100644 --- a/src/libCom/osi/os/WIN32/osdThread.c +++ b/src/libCom/osi/os/WIN32/osdThread.c @@ -438,20 +438,25 @@ static unsigned WINAPI epicsWin32ThreadEntry ( LPVOID lpParameter ) { win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal (); win32ThreadParam * pParm = ( win32ThreadParam * ) lpParameter; + unsigned retStat = 0u; BOOL success; - if ( ! pGbl ) { - fprintf ( stderr, "epicsWin32ThreadEntry: unable to find ctx\n" ); - return 0; + if ( pGbl ) { + SetThreadName ( pParm->id, pParm->pName ); + + success = TlsSetValue ( pGbl->tlsIndexThreadLibraryEPICS, pParm ); + if ( success ) { + /* printf ( "starting thread %d\n", pParm->id ); */ + ( *pParm->funptr ) ( pParm->parm ); + /* printf ( "terminating thread %d\n", pParm->id ); */ + retStat = 1; + } + else { + fprintf ( stderr, "epicsWin32ThreadEntry: unable to set private\n" ); + } } - - SetThreadName ( pParm->id, pParm->pName ); - - success = TlsSetValue ( pGbl->tlsIndexThreadLibraryEPICS, pParm ); - if ( success ) { - /* printf ( "starting thread %d\n", pParm->id ); */ - ( *pParm->funptr ) ( pParm->parm ); - /* printf ( "terminating thread %d\n", pParm->id ); */ + else { + fprintf ( stderr, "epicsWin32ThreadEntry: unable to find ctx\n" ); } /* @@ -459,7 +464,7 @@ static unsigned WINAPI epicsWin32ThreadEntry ( LPVOID lpParameter ) */ epicsParmCleanupWIN32 ( pParm ); - return ( ( unsigned ) success ); /* this indirectly closes the thread handle */ + return retStat; /* this indirectly closes the thread handle */ } static win32ThreadParam * epicsThreadParmCreate ( const char *pName )