#include #include pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER; int main() { pthread_t tid; pthread_create( &tid, nullptr, []( void * ) -> void * { pthread_mutex_lock( &mtx ); return nullptr; }, nullptr ); pthread_join( tid, nullptr ); pthread_mutex_lock( &mtx ); /* ERROR */ pthread_mutex_unlock( &mtx ); }