|
|
|
|
|
by halayli
3815 days ago
|
|
You might also want to look at lthread. It has some interesting functions like lthread_compute_begin()/end() to run expensive computations inside a coroutine. the compute methods move the coroutine into an actual pthread and resume until compute_end() is called. It also has c++11 bindings called lthread-cpp which allows you to launch coroutines with variable arguments & types and comes with nice socket wrappers. void MyMethod(std::vector<int> my_vec) {}
std::vector<int> v{1,2,3,4};
Lthread t1{&MyMethod, v};
t1.detach()
void my_coroutine()
{
lthread_compute_begin();
ret = fibonacci(55);
lthread_compute_end();
}
|
|