static void spinhaltIfAlreadyExiting(void) { #ifndef LAUNCHER volatile int temp; if (atomic_exchange_bool(&thisLocaleAlreadyExiting, true)) { // spin forever if somebody else already set it to 1 temp = 1; while (temp); } #endif }
int main(int argc, char** argv) { atomic_bool flag; atomic_store_bool(&flag, false); assert( false == atomic_exchange_bool(&flag, true) ); assert( true == atomic_exchange_bool(&flag, true) ); atomic_thread_fence(memory_order_seq_cst); atomic_signal_fence(memory_order_seq_cst); { atomic_uint_least8_t tmp; atomic_load_uint_least8_t(&tmp); } /* test(uint_least8_t); test(uint_least16_t); test(uint_least32_t); test(uint_least64_t); test(uintptr_t); */ return 0; }