Skip to content

Commit

Permalink
fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos committed Mar 7, 2024
1 parent e6af631 commit 7db4a8c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/coro_http/examples/example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,7 @@ void http_proxy() {
}

void coro_channel() {
auto ctx = coro_io::get_global_block_executor()->get_asio_executor();
asio::experimental::channel<void(std::error_code, int)> ch(ctx, 10000);
auto ch = coro_io::create_channel<int>(10000);
auto ec = async_simple::coro::syncAwait(coro_io::async_send(ch, 41));
assert(!ec);
ec = async_simple::coro::syncAwait(coro_io::async_send(ch, 42));
Expand All @@ -554,12 +553,12 @@ void coro_channel() {
std::error_code err;
int val;
std::tie(err, val) =
async_simple::coro::syncAwait(coro_io::async_receive<int>(ch));
async_simple::coro::syncAwait(coro_io::async_receive(ch));
assert(!err);
assert(val == 41);

std::tie(err, val) =
async_simple::coro::syncAwait(coro_io::async_receive<int>(ch));
async_simple::coro::syncAwait(coro_io::async_receive(ch));
assert(!err);
assert(val == 42);
}
Expand Down

0 comments on commit 7db4a8c

Please sign in to comment.