fix clang

This commit is contained in:
Crimson-Hawk 2024-04-26 17:07:18 +08:00
parent 22b5180b82
commit eed403ea0c
Signed by: Crimson-Hawk
GPG key ID: 0804DD39BB9BF5AC

View file

@ -17,11 +17,11 @@ struct Fiber::FiberImpl {
std::mutex guard; std::mutex guard;
bool released{}; bool released{};
bool is_thread_fiber{}; bool is_thread_fiber{};
Fiber *next_fiber{}; Fiber* next_fiber{};
Fiber **next_fiber_ptr; Fiber** next_fiber_ptr;
std::function<void()> entry_point; std::function<void()> entry_point;
mco_coro *context; mco_coro* context;
}; };
Fiber::Fiber() : impl{std::make_unique<FiberImpl>()} { Fiber::Fiber() : impl{std::make_unique<FiberImpl>()} {
@ -30,9 +30,8 @@ Fiber::Fiber() : impl{std::make_unique<FiberImpl>()} {
Fiber::Fiber(std::function<void()>&& entry_point_func) : impl{std::make_unique<FiberImpl>()} { Fiber::Fiber(std::function<void()>&& entry_point_func) : impl{std::make_unique<FiberImpl>()} {
impl->entry_point = std::move(entry_point_func); impl->entry_point = std::move(entry_point_func);
auto desc = mco_desc_init([] (mco_coro *coro) { auto desc = mco_desc_init(
reinterpret_cast<Fiber*>(coro->user_data)->impl->entry_point(); [](mco_coro* coro) { reinterpret_cast<Fiber*>(coro->user_data)->impl->entry_point(); }, 0);
}, 0);
desc.user_data = this; desc.user_data = this;
mco_result res = mco_create(&impl->context, &desc); mco_result res = mco_create(&impl->context, &desc);
ASSERT(res == MCO_SUCCESS); ASSERT(res == MCO_SUCCESS);