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:
Santiago Gimeno
2016-09-23 13:13:58 +02:00
parent d2054c73f3
commit c83a39e10d

View File

@@ -316,9 +316,9 @@ NAN_METHOD(CardReader::Close) {
} while ((ret != 0) && (++ times < 5));
}
uv_mutex_unlock(&obj->m_mutex);
assert(uv_thread_join(&obj->m_status_thread) == 0);
obj->m_status_thread = 0;
uv_mutex_unlock(&obj->m_mutex);
}
info.GetReturnValue().Set(Nan::New<Number>(result));