Skip to content

Instantly share code, notes, and snippets.

@lixin9311
Created November 8, 2016 13:21
Show Gist options
  • Save lixin9311/8bb00dfe792c279e43dd3a51d5d76fea to your computer and use it in GitHub Desktop.
Save lixin9311/8bb00dfe792c279e43dd3a51d5d76fea to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <unistd.h>
#include <mtbb/task_group.h>
int f() {
printf("child\n");
sleep(1);
return 0;
}
int main() {
mtbb::task_group tg;
tg.run([&] { f(); });
tg.wait();
printf("parent\n");
printf("All CPU are @ 100%%\n");
sleep(100); // changed to 100s to see the cpu usage
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment