Skip to content

pjc02478/lemon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

215 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lemon

callback's flow callback1 callback2
lemon's lemon

lemon은 C++에서 코루틴/Fiber/Async&Await등으로 불리는 기능을 사용할 수 있도록 해줍니다.
(VS2015 이상 버전에서는 await기능을 실험적적으로 지원합니다. (https://github.com/pjc0247/c11url#with-__await-syntax))

todo

  • multithread::pool 구현
  • concurrent_forward_list 구현
  • dispatcher thread-safe 패치
  • generator 구현

see

pros

  • 코드의 흐름과 프로그램의 흐름을 동기화 할 수 있습니다.
  • 이전의 구현
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();
    }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •