Fixed ExitThread, now running pthread_exit and setting event.

This commit is contained in:
Armin Novak 2014-07-16 12:08:34 +02:00
parent c6ed95d1bf
commit a6eff65259
2 changed files with 8 additions and 2 deletions

View File

@ -163,7 +163,7 @@ WINPR_API HANDLE CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T d
WINPR_API HANDLE CreateRemoteThread(HANDLE hProcess, LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize,
LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId);
WINPR_API VOID ExitThread(DWORD dwExitCode);
WINPR_API DECLSPEC_NORETURN VOID ExitThread(DWORD dwExitCode);
WINPR_API BOOL GetExitCodeThread(HANDLE hThread, LPDWORD lpExitCode);
WINPR_API HANDLE _GetCurrentThread(void);

View File

@ -425,6 +425,12 @@ VOID ExitThread(DWORD dwExitCode)
backtrace(thread->exit_stack, 20);
#endif
ListDictionary_Unlock(thread_list);
set_event(thread);
if (thread->detached || !thread->started)
cleanup_handle(thread);
pthread_exit(thread->dwExitCode);
}
}
@ -537,7 +543,7 @@ VOID DumpThreadHandles(void)
#if defined(HAVE_EXECINFO_H)
backtrace(stack, 20);
#endif
fprintf(stderr, "---------------- %s ----------------------\n", __FUNCTION);
fprintf(stderr, "---------------- %s ----------------------\n", __FUNCTION);
fprintf(stderr, "---------------- Called from ----------------------------\n");
#if defined(HAVE_EXECINFO_H)
backtrace_symbols_fd(stack, 20, STDERR_FILENO);