Skip to content

Instantly share code, notes, and snippets.

@tobiastom
Created October 9, 2009 01:07
Show Gist options
  • Save tobiastom/205596 to your computer and use it in GitHub Desktop.
Save tobiastom/205596 to your computer and use it in GitHub Desktop.
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <dispatch/dispatch.h>
int main(void) {
dispatch_queue_t the_queue = dispatch_get_concurrent_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT);
size_t iterations = 100;
dispatch_apply(iterations, the_queue, ^(size_t idx) {
sleep(rand()%10);
printf("%zu\n", idx);
});
exit(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment