Skip to content

Instantly share code, notes, and snippets.

@s4y
Last active December 16, 2015 00:49
Show Gist options
  • Save s4y/5350673 to your computer and use it in GitHub Desktop.
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.
#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");
}
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