Skip to content

Commit 371ed93

Browse files
committed
Sync capy changes
1 parent 54922ee commit 371ed93

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

include/boost/http/bcrypt.hpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,15 @@
4141
#include <boost/system/error_code.hpp>
4242
#include <boost/system/is_error_code_enum.hpp>
4343

44-
#include <boost/capy/coro.hpp>
4544
#include <boost/capy/task.hpp>
4645
#include <boost/capy/ex/executor_ref.hpp>
46+
#include <boost/capy/ex/io_env.hpp>
4747
#include <boost/capy/ex/run_async.hpp>
4848
#include <boost/capy/ex/system_context.hpp>
4949

5050
#include <cstddef>
5151
#include <cstring>
5252
#include <exception>
53-
#include <stop_token>
5453
#include <string>
5554
#include <system_error>
5655

@@ -532,24 +531,24 @@ struct hash_async_op
532531
}
533532

534533
void await_suspend(
535-
capy::coro cont,
536-
capy::executor_ref caller_ex,
537-
std::stop_token)
534+
std::coroutine_handle<void> cont,
535+
capy::io_env const* env)
538536
{
537+
auto caller_ex = env->executor;
539538
auto& pool = capy::get_system_context();
540539
auto sys_ex = pool.get_executor();
541540
capy::run_async(sys_ex,
542541
[this, cont, caller_ex]
543542
(result r) mutable
544543
{
545544
result_ = r;
546-
caller_ex.dispatch(cont);
545+
caller_ex.dispatch(cont).resume();
547546
},
548547
[this, cont, caller_ex]
549548
(std::exception_ptr ep) mutable
550549
{
551550
ep_ = ep;
552-
caller_ex.dispatch(cont);
551+
caller_ex.dispatch(cont).resume();
553552
}
554553
)(hash_task(password_, rounds_, ver_));
555554
}
@@ -575,24 +574,24 @@ struct compare_async_op
575574
}
576575

577576
void await_suspend(
578-
capy::coro cont,
579-
capy::executor_ref caller_ex,
580-
std::stop_token)
577+
std::coroutine_handle<void> cont,
578+
capy::io_env const* env)
581579
{
580+
auto caller_ex = env->executor;
582581
auto& pool = capy::get_system_context();
583582
auto sys_ex = pool.get_executor();
584583
capy::run_async(sys_ex,
585584
[this, cont, caller_ex]
586585
(bool ok) mutable
587586
{
588587
result_ = ok;
589-
caller_ex.dispatch(cont);
588+
caller_ex.dispatch(cont).resume();
590589
},
591590
[this, cont, caller_ex]
592591
(std::exception_ptr ep) mutable
593592
{
594593
ep_ = ep;
595-
caller_ex.dispatch(cont);
594+
caller_ex.dispatch(cont).resume();
596595
}
597596
)(compare_task(password_, hash_str_));
598597
}

test/unit/bcrypt.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
#include <boost/http/bcrypt.hpp>
1111

12-
#include <boost/capy/coro.hpp>
1312
#include <boost/capy/ex/execution_context.hpp>
1413
#include <boost/capy/ex/run_async.hpp>
1514
#include <boost/capy/ex/system_context.hpp>
@@ -51,12 +50,12 @@ struct test_executor
5150
void on_work_started() const noexcept {}
5251
void on_work_finished() const noexcept {}
5352

54-
void dispatch(capy::coro h) const
53+
std::coroutine_handle<> dispatch(std::coroutine_handle<void> h) const
5554
{
56-
h.resume();
55+
return h;
5756
}
5857

59-
void post(capy::coro h) const
58+
void post(std::coroutine_handle<void> h) const
6059
{
6160
h.resume();
6261
}

test/unit/json/json_sink.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <boost/capy/buffers.hpp>
1414
#include <boost/capy/buffers/make_buffer.hpp>
1515
#include <boost/capy/concept/write_sink.hpp>
16-
#include <boost/capy/coro.hpp>
1716
#include <boost/capy/ex/execution_context.hpp>
1817
#include <boost/capy/ex/run_async.hpp>
1918
#include <boost/capy/io_result.hpp>
@@ -68,14 +67,14 @@ struct test_executor
6867
void on_work_started() const noexcept {}
6968
void on_work_finished() const noexcept {}
7069

71-
void dispatch(capy::coro h) const
70+
std::coroutine_handle<> dispatch(std::coroutine_handle<void> h) const
7271
{
7372
if(dispatch_count_)
7473
++(*dispatch_count_);
75-
h.resume();
74+
return h;
7675
}
7776

78-
void post(capy::coro h) const
77+
void post(std::coroutine_handle<void> h) const
7978
{
8079
h.resume();
8180
}

0 commit comments

Comments
 (0)