static void* add_thread(void* arg) { int loop = 0; int32_t icount = 0; FOUNDATION_UNUSED(arg); while (!thread_try_wait(0) && (loop < 65535)) { for (icount = 0; icount < 128; ++icount) { atomic_add32(&val_32, icount % 2 ? -icount : icount); atomic_exchange_and_add64(&val_64, icount % 2 ? -icount : icount); } for (icount = 0; icount < 128; ++icount) { atomic_exchange_and_add32(&val_32, icount % 2 ? icount : -icount); atomic_add64(&val_64, icount % 2 ? icount : -icount); } ++loop; thread_yield(); } return 0; }
void* add_thread( object_t thread, void* arg ) { int loop = 0; int32_t icount = 0; while( !thread_should_terminate( thread ) && ( loop < 65535 ) ) { for( icount = 0; icount < 128; ++icount ) { atomic_add32( &val_32, icount % 2 ? -icount : icount ); atomic_exchange_and_add64( &val_64, icount % 2 ? -icount : icount ); } for( icount = 0; icount < 128; ++icount ) { atomic_exchange_and_add32( &val_32, icount % 2 ? icount : -icount ); atomic_add64( &val_64, icount % 2 ? icount : -icount ); } ++loop; thread_yield(); } return 0; }