/* TAGS: min */ /* VERIFY_OPTS: -o nofail:malloc */ /* CC_OPTS: */ // V: safety // V: local V_OPT: --nontermination local // V: global V_OPT: --nontermination global #include #include int main() { pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER; int x = 0; std::thread t( [&] { pthread_mutex_lock( &mtx ); x = 42; pthread_mutex_unlock( &mtx ); } ); for ( int a = 0; a != 42; ) { pthread_mutex_lock( &mtx ); a = x; pthread_mutex_unlock( &mtx ); } t.join(); }