Created
November 8, 2016 13:21
-
-
Save lixin9311/8bb00dfe792c279e43dd3a51d5d76fea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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