libuv version: 1.91
Platform: WIN7 x64, the app is x86
I use VS2015, and put the libuv int a dll to do a server, the libuv not use thread or work queue.
i have a std::mutex, module_mutex, and only use it in echo_read and tcp close callback.
when try to lock the mutex in echo_read, sometimes failed to lock it, It finally go to mutex.c in function
I don't know why this happens, and what i can do, thanks
static int mtx_do_lock(_Mtx_t mtx, const xtime *target)
{ /* lock mutex */
if ((mtx->type & ~_Mtx_recursive) == _Mtx_plain)
{ /* set the lock */
if (mtx->thread_id != static_cast<long>(GetCurrentThreadId()))
{ /* not current thread, do lock */
mtx->_get_cs()->lock();
mtx->thread_id = static_cast<long>(GetCurrentThreadId());
}
++mtx->count;
return (_Thrd_success);
}
else
{ /* handle timed or recursive mutex */
int res = WAIT_TIMEOUT;
if (target == 0)
{ /* no target --> plain wait (i.e. infinite timeout) */
if (mtx->thread_id != static_cast<long>(GetCurrentThreadId())) <--------------err happened
mtx->_get_cs()->lock();
res = WAIT_OBJECT_0;
}
...
}
void echo_read(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf)
{
if (nread < 0) {
} else if (nread > 0) {
unique_lock<mutex>lk(module_mutex);
}
}
libuv version: 1.91 Platform: WIN7 x64, the app is x86
I use VS2015, and put the libuv int a dll to do a server, the libuv not use thread or work queue. i have a std::mutex, module_mutex, and only use it in echo_read and tcp close callback. when try to lock the mutex in echo_read, sometimes failed to lock it, It finally go to mutex.c in function I don't know why this happens, and what i can do, thanks