#include #include enum { iterations = 64 }; static int total; static void *increment(void *unused) { (void)unused; for (int i = 0; i < iterations; ++i) { __transaction_atomic { ++total; } } return NULL; } int main(void) { pthread_t thread; if (pthread_create(&thread, NULL, increment, NULL) != 0) return 1; increment(NULL); if (pthread_join(thread, NULL) != 0) return 1; printf("transaction total %d\n", total); return total != 2 * iterations; }