test: make thread tests run fine also on Windows
This commit is contained in:
parent
9ed3eaebd1
commit
d2cc600e97
@ -34,10 +34,24 @@ TEST(Mutex, LockUnlock) {
|
|||||||
auto mtx = loop->resource<uvw::Mutex>();
|
auto mtx = loop->resource<uvw::Mutex>();
|
||||||
|
|
||||||
mtx->lock();
|
mtx->lock();
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
// this is allowed by libuv on Windows
|
||||||
|
ASSERT_TRUE(mtx->tryLock());
|
||||||
|
#else
|
||||||
ASSERT_FALSE(mtx->tryLock());
|
ASSERT_FALSE(mtx->tryLock());
|
||||||
|
#endif
|
||||||
|
|
||||||
mtx->unlock();
|
mtx->unlock();
|
||||||
ASSERT_TRUE(mtx->tryLock());
|
ASSERT_TRUE(mtx->tryLock());
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
// this is allowed by libuv on Windows
|
||||||
|
ASSERT_TRUE(mtx->tryLock());
|
||||||
|
#else
|
||||||
ASSERT_FALSE(mtx->tryLock());
|
ASSERT_FALSE(mtx->tryLock());
|
||||||
|
#endif
|
||||||
|
|
||||||
mtx->unlock();
|
mtx->unlock();
|
||||||
|
|
||||||
loop->run();
|
loop->run();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user