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