Commit 53ffcef9 authored by Harris Hancock's avatar Harris Hancock

Fix premature ThreadState deletion in MSVC-specific code

parent 268577e7
......@@ -134,7 +134,7 @@ void* Thread::runThread(void* ptr) {
void Thread::ThreadState::unref() {
#if _MSC_VER
if (_InterlockedDecrement(&refcount)) {
if (_InterlockedDecrement(&refcount) == 0) {
#else
if (__atomic_sub_fetch(&refcount, 1, __ATOMIC_RELEASE) == 0) {
__atomic_thread_fence(__ATOMIC_ACQUIRE);
......
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