diff --git a/tests/gtests/gtest_tcp.cpp b/tests/gtests/gtest_tcp.cpp index c9a6592..18ba48b 100644 --- a/tests/gtests/gtest_tcp.cpp +++ b/tests/gtests/gtest_tcp.cpp @@ -11,7 +11,7 @@ using namespace uvio::sync; TEST(TestTcpListener, ListenAndAccept) { Latch latch(3); - auto server = [&latch]() -> Task<> { + auto server = [](Latch &latch) -> Task<> { std::array buf{}; auto listener = TcpListener(); @@ -25,7 +25,7 @@ TEST(TestTcpListener, ListenAndAccept) { co_await stream.write(buf.data()); }; - auto client = [&latch]() -> Task<> { + auto client = [](Latch &latch) -> Task<> { std::array buf{}; co_await latch.arrive_and_wait(); @@ -40,7 +40,7 @@ TEST(TestTcpListener, ListenAndAccept) { co_await latch.arrive_and_wait(); }; - spawn(server()); - spawn(client()); + spawn(server(latch)); + spawn(client(latch)); block_on(wait(latch)); } diff --git a/uvio/sync.hpp b/uvio/sync.hpp new file mode 100644 index 0000000..cd78e9a --- /dev/null +++ b/uvio/sync.hpp @@ -0,0 +1,3 @@ +#pragma once + +#include "uvio/sync/latch.hpp"