wxwidgets - wxCriticalSection under Linux/Unix -
i discovered wxcriticalsection not recursive ( deadlock when thread grabs section more once ) under linux. looking @ sources, discovered wxcriticalsection implemented using wxmutex under linux, without using wxmutex_recursive. have codebase runs under win , mac, , want port linux, have deadlocks @ places did not avoid recursion.
now have 2 possibilities:
changing , rebuilding wxwidgets purpose ( brrr - chance want avpid since not know design decisions behind )
debugging each , of possible code paths ( brrr - take days , horribly bug - prone )
is there third way, replacing/extending wxcriticalsection construct behaves equally under mac/win/unix?
ps. explain design decision me? mr. vadim z says ...
i had temporarily forgot reason against (making wxcriticalsections recursive) did recall 30 seconds later (after sending message, of course ). please see follow-up
but there never follow-up ...
in version 2.9.1, appears default should recursive. in file \wxwidgets-2.9.1\include\wx\thread.h
:
inline wxcriticalsection::wxcriticalsection( wxcriticalsectiontype critsectype ) : m_mutex( critsectype == wxcritsec_default ? wxmutex_recursive : wxmutex_default ) { }
and in class wxcriticalsection
constructor declaration is
wxcritsect_inline wxcriticalsection( wxcriticalsectiontype critsectype = wxcritsec_default );
i don't use linux, can't verify wxcriticalsection
recursive when compiled.
Comments
Post a Comment