Boost C++ Libraries: Ticket #6292: native_handle_type missing on timed_mutex/recursive_timed_mutex when they are not native but emulated https://svn.boost.org/trac10/ticket/6292 <p> boost/pthread/mutex.hpp defines </p> <pre class="wiki"> typedef pthread_mutex_t* native_handle_type; native_handle_type native_handle() { return &amp;m; } </pre><p> only when BOOST_PTHREAD_HAS_TIMEDLOCK is defined. </p> <p> The following error occurs when trying to use them </p> <pre class="wiki">clang-darwin.compile.c++ ../../../bin.v2/libs/thread/test/v2_timed_mutex_native_handle_pass.test/clang-darwin-2.9x/debug/threading-multi/sync/mutual_exclusion/timed_mutex/native_handle_pass.o sync/mutual_exclusion/timed_mutex/native_handle_pass.cpp:29:23: error: no member named 'native_handle_type' in 'boost::timed_mutex' boost::timed_mutex::native_handle_type h = m.native_handle(); ~~~~~~~~~~~~~~~~~~~~^ </pre><p> It seems to me that even some kind of handle must be returned by the native_handle function in this case. </p> <p> Maybe the return type could be a pointer to struct containing the implementation fields </p> <pre class="wiki"> struct native_handle_struct { pthread_mutex_t m; pthread_cond_t cond; bool is_locked; }; typedef native_handle_struct* native_handle_type; </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6292 Trac 1.4.3 viboes Sun, 18 Dec 2011 20:41:23 GMT summary changed https://svn.boost.org/trac10/ticket/6292#comment:1 https://svn.boost.org/trac10/ticket/6292#comment:1 <ul> <li><strong>summary</strong> <span class="trac-field-old">native_handle_type missing on timed_mutex when BOOST_PTHREAD_HAS_TIMEDLOCK is not defined</span> → <span class="trac-field-new">native_handle_type missing on timed_mutex/recursive_timed_mutex when BOOST_PTHREAD_HAS_TIMEDLOCK is not defined</span> </li> </ul> <p> The same applies to recursive_timed_mutex. </p> Ticket viboes Tue, 17 Jan 2012 07:22:56 GMT summary changed https://svn.boost.org/trac10/ticket/6292#comment:2 https://svn.boost.org/trac10/ticket/6292#comment:2 <ul> <li><strong>summary</strong> <span class="trac-field-old">native_handle_type missing on timed_mutex/recursive_timed_mutex when BOOST_PTHREAD_HAS_TIMEDLOCK is not defined</span> → <span class="trac-field-new">native_handle_type missing on timed_mutex/recursive_timed_mutex when they are not native but emulated</span> </li> </ul> <p> The same applies to Windows as timed mutex are emulated. </p> Ticket viboes Sat, 11 Feb 2012 22:38:05 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6292#comment:3 https://svn.boost.org/trac10/ticket/6292#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> Well, after reading the standard it is implementation-defined, so Boost.Thread is conforming without providing them. </p> Ticket