Fix failure to restart after calling LiStopConnection

This commit is contained in:
Cameron Gutman 2016-02-16 09:04:21 -05:00
parent 9e592ad3c6
commit ac52faa6c2

View File

@ -127,7 +127,7 @@ void PltUnlockMutex(PLT_MUTEX* mutex) {
}
void PltJoinThread(PLT_THREAD* thread) {
LC_ASSERT(thread->cancelled != 0);
LC_ASSERT(thread->cancelled);
#if defined(LC_WINDOWS)
WaitForSingleObjectEx(thread->handle, INFINITE, FALSE);
#else
@ -195,6 +195,8 @@ int PltCreateThread(ThreadEntry entry, void* context, PLT_THREAD* thread) {
ctx->context = context;
ctx->thread = thread;
thread->cancelled = 0;
#if defined(LC_WINDOWS)
{
thread->termRequested = CreateEventEx(NULL, NULL, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS);
@ -203,8 +205,6 @@ int PltCreateThread(ThreadEntry entry, void* context, PLT_THREAD* thread) {
return -1;
}
thread->cancelled = 0;
thread->handle = CreateThread(NULL, 0, ThreadProc, ctx, 0, &thread->tid);
if (thread->handle == NULL) {
CloseHandle(thread->termRequested);