Last active
December 16, 2015 00:49
-
-
Save s4y/5350673 to your computer and use it in GitHub Desktop.
I'm working on a concurrency library inspired by Tame. I'm kinda loving it. Main difference: no code transformation.
This file contains hidden or 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 <async.h> | |
void printLater(unsigned int seconds, const char message[]) { | |
asleep(seconds); | |
printf("%s\n", message); | |
} | |
void amain() { | |
printf("Before\n"); | |
{ await | |
A(printLater(1, "First thing done")); | |
printf("Kicked off one thing\n"); | |
A(printLater(2, "Second thing done")); | |
printf("Kicked off another thing\n"); | |
} | |
printf("After\n"); | |
} |
This file contains hidden or 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
Before | |
Kicked off one thing | |
Kicked off another thing | |
First thing done | |
Second thing done | |
After |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment