src: fix deadlock in CardReader
Move the `uv_mutex_unlock` before the `uv_thread_join` as it could perfectly lock with `CardReader::HandlerFunction` `uv_mutex_unlock`.
This commit is contained in:
@@ -316,9 +316,9 @@ NAN_METHOD(CardReader::Close) {
|
|||||||
} while ((ret != 0) && (++ times < 5));
|
} while ((ret != 0) && (++ times < 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uv_mutex_unlock(&obj->m_mutex);
|
||||||
assert(uv_thread_join(&obj->m_status_thread) == 0);
|
assert(uv_thread_join(&obj->m_status_thread) == 0);
|
||||||
obj->m_status_thread = 0;
|
obj->m_status_thread = 0;
|
||||||
uv_mutex_unlock(&obj->m_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
info.GetReturnValue().Set(Nan::New<Number>(result));
|
info.GetReturnValue().Set(Nan::New<Number>(result));
|
||||||
|
|||||||
Reference in New Issue
Block a user