// S : tags min threads c c11 $TAGS // S : expect --result valid // S : cc -o test.bc -std=c11 $CC_OPT $file // S : verify $V_OPT test.bc #include #include int shared = 0; mtx_t mutex; int thread( void *x ) { mtx_lock( &mutex ); ++shared; mtx_unlock( &mutex ); return 42; } int main() { thrd_t tid; mtx_init( &mutex, mtx_plain ); thrd_create( &tid, thread, NULL ); mtx_lock( &mutex ); ++shared; mtx_unlock( &mutex ); int res; thrd_join( tid, &res ); assert( res == 42 ); assert( shared == 2 ); return 0; }