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) { void PltJoinThread(PLT_THREAD* thread) {
LC_ASSERT(thread->cancelled != 0); LC_ASSERT(thread->cancelled);
#if defined(LC_WINDOWS) #if defined(LC_WINDOWS)
WaitForSingleObjectEx(thread->handle, INFINITE, FALSE); WaitForSingleObjectEx(thread->handle, INFINITE, FALSE);
#else #else
@ -194,6 +194,8 @@ int PltCreateThread(ThreadEntry entry, void* context, PLT_THREAD* thread) {
ctx->entry = entry; ctx->entry = entry;
ctx->context = context; ctx->context = context;
ctx->thread = thread; ctx->thread = thread;
thread->cancelled = 0;
#if defined(LC_WINDOWS) #if defined(LC_WINDOWS)
{ {
@ -203,8 +205,6 @@ int PltCreateThread(ThreadEntry entry, void* context, PLT_THREAD* thread) {
return -1; return -1;
} }
thread->cancelled = 0;
thread->handle = CreateThread(NULL, 0, ThreadProc, ctx, 0, &thread->tid); thread->handle = CreateThread(NULL, 0, ThreadProc, ctx, 0, &thread->tid);
if (thread->handle == NULL) { if (thread->handle == NULL) {
CloseHandle(thread->termRequested); CloseHandle(thread->termRequested);