Edit readme

nonsync_wait
marcelb 2 months ago
parent 0b94c1e86c
commit d8e0d0b49d
  1. 14
      README.md

@ -85,9 +85,9 @@ Make functions asynchronous
* Run an lambda function asynchronously * Run an lambda function asynchronously
*/ */
asynco( []() { nonsync ( []() {
sleep_for(2s); // only for simulating long duration function sleep_for(2s); // only for simulating long duration function
cout << "asynco" << endl; cout << "nonsync " << endl;
return 5; return 5;
}); });
@ -100,7 +100,7 @@ void notLambdaFunction() {
cout << "Call to not lambda function" << endl; cout << "Call to not lambda function" << endl;
} }
asynco (notLambdaFunction); nonsync (notLambdaFunction);
/** /**
* Run class method * Run class method
@ -114,7 +114,7 @@ class clm {
}; };
clm classes; clm classes;
asynco( [&classes] () { nonsync ( [&classes] () {
classes.classMethode(); classes.classMethode();
}); });
@ -124,9 +124,9 @@ asynco( [&classes] () {
* Wait after runned as async * Wait after runned as async
*/ */
auto a = asynco( []() { auto a = nonsync ( []() {
sleep_for(2s); // only for simulating long duration function sleep_for(2s); // only for simulating long duration function
cout << "asynco" << endl; cout << "nonsync " << endl;
return 5; return 5;
}); });
@ -136,7 +136,7 @@ cout << wait(a) << endl;
* Wait async function call and use i cout * Wait async function call and use i cout
*/ */
cout << wait(asynco( [] () { cout << wait(nonsync ( [] () {
sleep_for(chrono::seconds(1)); // only for simulating long duration function sleep_for(chrono::seconds(1)); // only for simulating long duration function
cout << "wait end" << endl; cout << "wait end" << endl;
return 4; return 4;

Loading…
Cancel
Save