1
This commit is contained in:
parent
1b43f53bb2
commit
c8f08c2975
@ -127,6 +127,7 @@ target_link_libraries(
|
||||
hiredis
|
||||
tinyxml2
|
||||
backtrace
|
||||
boost_context
|
||||
)
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
|
@ -2,9 +2,23 @@
|
||||
|
||||
#include "coroutine.h"
|
||||
|
||||
Coroutine::Coroutine(std::function<void(Coroutine* co)> cb)
|
||||
Coroutine::Coroutine(std::function<void(Coroutine*)> cb)
|
||||
{
|
||||
cb_ = cb;
|
||||
#if 0
|
||||
source_ = std::make_shared<boost::coroutines2::coroutine<void>::pull_type>
|
||||
(
|
||||
[&] (boost::coroutines2::coroutine<void>::pull_type& sink)
|
||||
{
|
||||
|
||||
});
|
||||
#endif
|
||||
boost::coroutines2::coroutine<void>::pull_type source
|
||||
(
|
||||
[&] (boost::coroutines2::coroutine<void>::push_type& sink)
|
||||
{
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void Coroutine::CoSuspend()
|
||||
|
@ -16,7 +16,7 @@ class Coroutine : public Awaiter
|
||||
{
|
||||
public:
|
||||
|
||||
Coroutine(std::function<void(Coroutine* co)> cb);
|
||||
Coroutine(std::function<void(Coroutine*)> cb);
|
||||
|
||||
void CoSuspend();
|
||||
void CoResume();
|
||||
@ -24,6 +24,6 @@ class Coroutine : public Awaiter
|
||||
void CoAwait(Awaiter* awaiter);
|
||||
|
||||
private:
|
||||
boost::coroutines2::coroutine<void> coro_;
|
||||
std::shared_ptr<boost::coroutines2::coroutine<void>::pull_type> source_;
|
||||
std::function<void(Coroutine* co)> cb_;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user