Skip to content

Commit

Permalink
include macOS ucontext support
Browse files Browse the repository at this point in the history
  • Loading branch information
attobit committed Sep 10, 2016
1 parent cd42317 commit e1ba41f
Showing 2 changed files with 20 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# C++11 single .h asymmetric coroutine implementation

### API

* routine_t create_routine(std::function<void()> f);
* void destroy_routine(routine_t id);
* int resume(routine_t id);
* void yield();
* TYPE await(TYPE(*f)());
* routine_t current_routine();

### OS

* Windows
* macOS
* Linux


```cpp
#include "coroutine.h"
using namespace coroutine;
4 changes: 4 additions & 0 deletions coroutine.h
Original file line number Diff line number Diff line change
@@ -203,7 +203,11 @@ await(Function&& func)

#else

#if __APPLE__ && __MACH__
#include <sys/ucontext.h>
#else
#include <ucontext.h>
#endif

namespace coroutine {

0 comments on commit e1ba41f

Please sign in to comment.