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
2020-05-03 18:42:39 +02:00

18 lines
326 B
C++

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