Call THREAD_FreeTHDB as service thread callback.
This commit is contained in:
parent
e9caf93bbb
commit
36a1a25f0e
@ -85,6 +85,7 @@ typedef struct _THDB
|
|||||||
void *server_tid; /* Server id for this thread */
|
void *server_tid; /* Server id for this thread */
|
||||||
void (*startup)(void); /* Thread startup routine */
|
void (*startup)(void); /* Thread startup routine */
|
||||||
struct _THDB *next; /* Global thread list */
|
struct _THDB *next; /* Global thread list */
|
||||||
|
DWORD cleanup; /* Cleanup service handle */
|
||||||
} THDB;
|
} THDB;
|
||||||
|
|
||||||
/* The pseudo handle value returned by GetCurrentThread */
|
/* The pseudo handle value returned by GetCurrentThread */
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "selectors.h"
|
#include "selectors.h"
|
||||||
#include "winnt.h"
|
#include "winnt.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
|
#include "services.h"
|
||||||
#include "stackframe.h"
|
#include "stackframe.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
@ -152,10 +153,14 @@ error:
|
|||||||
* Free data structures associated with a thread.
|
* Free data structures associated with a thread.
|
||||||
* Must be called from the context of another thread.
|
* Must be called from the context of another thread.
|
||||||
*/
|
*/
|
||||||
void THREAD_FreeTHDB( THDB *thdb )
|
void CALLBACK THREAD_FreeTHDB( ULONG_PTR arg )
|
||||||
{
|
{
|
||||||
|
THDB *thdb = (THDB *)arg;
|
||||||
THDB **pptr = &THREAD_First;
|
THDB **pptr = &THREAD_First;
|
||||||
|
|
||||||
|
TRACE( thread, "(%p) called\n", thdb );
|
||||||
|
SERVICE_Delete( thdb->cleanup );
|
||||||
|
|
||||||
PROCESS_CallUserSignalProc( USIG_THREAD_EXIT, 0, 0 );
|
PROCESS_CallUserSignalProc( USIG_THREAD_EXIT, 0, 0 );
|
||||||
|
|
||||||
CloseHandle( thdb->event );
|
CloseHandle( thdb->event );
|
||||||
@ -261,6 +266,11 @@ THDB *THREAD_Create( PDB *pdb, DWORD flags, DWORD stack_size, BOOL alloc_stack16
|
|||||||
if (!THREAD_InitTHDB( thdb, stack_size, alloc_stack16, sa )) goto error;
|
if (!THREAD_InitTHDB( thdb, stack_size, alloc_stack16, sa )) goto error;
|
||||||
thdb->next = THREAD_First;
|
thdb->next = THREAD_First;
|
||||||
THREAD_First = thdb;
|
THREAD_First = thdb;
|
||||||
|
|
||||||
|
/* Install cleanup handler */
|
||||||
|
|
||||||
|
thdb->cleanup = SERVICE_AddObject( *server_handle,
|
||||||
|
THREAD_FreeTHDB, (ULONG_PTR)thdb );
|
||||||
return thdb;
|
return thdb;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user