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) {
if (!detached) {
KJ_ASSERT(WaitForSingleObject(threadHandle, INFINITE) != WAIT_FAILED);
KJ_IF_MAYBE(e, exception) {
KJ_IF_MAYBE(e, state->exception) {
kj::throwRecoverableException(kj::mv(*e));
}
}
......@@ -125,7 +125,7 @@ void* Thread::runThread(void* ptr) {
void Thread::ThreadState::unref() {
#if _MSC_VER
if (_InterlockedDecrement_rel(&refcount)) {
if (_InterlockedDecrement(&refcount)) {
_ReadBarrier();
#else
if (__atomic_sub_fetch(&refcount, 1, __ATOMIC_RELEASE) == 0) {
......
......@@ -59,7 +59,7 @@ private:
Function<void()> func;
kj::Maybe<kj::Exception> exception;
int refcount;
unsigned int refcount;
// Owned by the parent thread and the child thread.
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