Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.
/ ergo Public archive

Co-routine inspired task operation library.

License

Notifications You must be signed in to change notification settings

MetisMachine/ergo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ergo

Ergo is an easy to use concurrent operation library for C++11 and up.

Usage

// Function to call within the operation.
void plusplus(int value) {
  cout << "Value In: " << value << endl;

   // We increase the value.
  value++;
  
  // Let's return.
  Ergo::Operation::yield();

  cout << "Value out: " << value << endl;
}

int main(int argc, char **argv) {
  cout << "Starting" << endl;

  // Create a new operation
  Ergo::Operation a([]() {
    plusplus(10);
  });

  // Create another operation
  Ergo::Operation b([]{
    plusplus(20);
  });

  a.resume();
  b.resume();
  b.resume();
  a.resume();
  a.resume();

  // Create an operation to use With a while loop
  Ergo::Operation loopy([]{
    plusplus(30);
  });

  // Loop and wait for the _loopy_ operation to finish.
  while(!loopy.complete()) {
    loopy.resume();
  }

  cout << "Complete" << endl;
}

About

Co-routine inspired task operation library.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published