1
0
Fork 0
mirror of https://gitlab.com/niansa/libasync.git synced 2025-03-06 20:53:29 +01:00
libasync/tests/mutex.cpp

15 lines
252 B
C++

#include <new>
#include <async/mutex.hpp>
#include <async/result.hpp>
#include <gtest/gtest.h>
TEST(Mutex, TryLock) {
async::mutex m;
async::run(m.async_lock());
ASSERT_FALSE(m.try_lock());
m.unlock();
ASSERT_TRUE(m.try_lock());
m.unlock();
}