
Dears, I had observed dead lock in call_once (posix code). How to understand what causes this dead lock?Windows code works well - my usage of call_once runs normally on windows, but ported to Linuxhangs. Below I had marked where the code is waiting (endless) - see line with '// ***'. I understand that condition "flag.epoch==uninitialized_flag" is not fullfilled, but"flag.epoch==being_initialized" is passed. So it seems that: pthread_cond_waitis waiting, but I have no clue for what it is waiting. Especially that I haveno real access to "detail::once_epoch_cv" - seems to be private member of thenamespace. Also I observed that there is single hit to that function. The whileloop is done once - program is entering while and stops on the first pthread_cond_wait. template void call_once(once_flag try { pthread::pthread_mutex_scoped_unlock relocker( f(); } catch(...) { flag.epoch=uninitialized_flag; BOOST_VERIFY(!pthread_cond_broadcast( throw; } flag.epoch=--detail::once_global_epoch; BOOST_VERIFY(!pthread_cond_broadcast( } else { while(flag.epoch==being_initialized) { BOOST_VERIFY(!pthread_cond_wait(&detail::once_epoch_cv, // *** first hit here causes dead lock } } Best regards,Seweryn Habdank-Wojewodzki.
participants (1)
-
seweryn@habdank.pl