callback's flow

lemon's

lemon은 C++에서 코루틴/Fiber/Async&Await등으로 불리는 기능을 사용할 수 있도록 해줍니다.
(VS2015 이상 버전에서는 await기능을 실험적적으로 지원합니다. (https://github.com/pjc0247/c11url#with-__await-syntax))
- multithread::pool 구현
- concurrent_forward_list 구현
- dispatcher thread-safe 패치
- generator 구현
- 코드의 흐름과 프로그램의 흐름을 동기화 할 수 있습니다.
- 이전의 구현
void pre_heavy_work(){
printf("begin work\n");
/* ... */
work_pool.post_heavy_work();
}
void post_heavy_work(){
printf("end work\n");
/* ... */
response();
}- lemon을 이용하면
void func(){
printf("begin work\n");
heavy_work();
printf("end work\n");
response();
}-
스케쥴링이 필요할 때, 별도의 스케쥴러가 필요없고 오브젝트 스스로가 자신을 스케쥴링 할 수 있도록 작성할 수 있습니다.
void object::update(){ printf("hello update!\n"); } void object::schedule_update(){ microthread::create([this](){ while(true){ flowcontrol::delay(time::frame<60>(1)); update(); } }).schedule(); }