mootoh (owner)

Revisions

gist: 179672 Download_button fork
public
Public Clone URL: git://gist.github.com/179672.git
Embed All Files: show embed
dispatch_local_var.c #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include <unistd.h>
#include <dispatch/dispatch.h>
 
int main(int argc, char **argv)
{
   int x = 3;
 
   dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{
      sleep(1);
      printf("x in async block : %d\n", x);
   });
 
   x = 7;
   printf("x in outside block : %d\n", x);
 
   sleep(2);
 
   return 0;
}