Commit 651c5262 authored by Mark Grimes's avatar Mark Grimes

Fixes to get PR #364 working on MSVC

parent ce99c604
...@@ -42,7 +42,7 @@ Thread::~Thread() noexcept(false) { ...@@ -42,7 +42,7 @@ Thread::~Thread() noexcept(false) {
if (!detached) { if (!detached) {
KJ_ASSERT(WaitForSingleObject(threadHandle, INFINITE) != WAIT_FAILED); KJ_ASSERT(WaitForSingleObject(threadHandle, INFINITE) != WAIT_FAILED);
KJ_IF_MAYBE(e, exception) { KJ_IF_MAYBE(e, state->exception) {
kj::throwRecoverableException(kj::mv(*e)); kj::throwRecoverableException(kj::mv(*e));
} }
} }
...@@ -125,7 +125,7 @@ void* Thread::runThread(void* ptr) { ...@@ -125,7 +125,7 @@ void* Thread::runThread(void* ptr) {
void Thread::ThreadState::unref() { void Thread::ThreadState::unref() {
#if _MSC_VER #if _MSC_VER
if (_InterlockedDecrement_rel(&refcount)) { if (_InterlockedDecrement(&refcount)) {
_ReadBarrier(); _ReadBarrier();
#else #else
if (__atomic_sub_fetch(&refcount, 1, __ATOMIC_RELEASE) == 0) { if (__atomic_sub_fetch(&refcount, 1, __ATOMIC_RELEASE) == 0) {
......
...@@ -59,7 +59,7 @@ private: ...@@ -59,7 +59,7 @@ private:
Function<void()> func; Function<void()> func;
kj::Maybe<kj::Exception> exception; kj::Maybe<kj::Exception> exception;
int refcount; unsigned int refcount;
// Owned by the parent thread and the child thread. // Owned by the parent thread and the child thread.
void unref(); void unref();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment