Displaying 1 result from an estimated 1 matches for "dispatch_main".
2015 Apr 08
2
[LLVMdev] __sync_add_and_fetch in objc block for global variable on ARM
...async queue */
dispatch_async(queue, ^{
__sync_add_and_fetch(&count, 1); //<< Here count is corrupted in case of number of threads> ~5
printf("count addr %p, value %d\n", &count, count);
fflush(stdout);
});
}
...
dispatch_main();
}
in case of count is local variable in scope of main function and has __block attribute, all is fine.
I'm using
clang version 3.3 (tags/RELEASE_33/final)
Target: armv7l-unknown-linux-gnueabi
Thread model: posix
libBlockRuntime 0.3
libdispatch for linux 1.2
CPU is ARMv7,
in disas I see dmb...