Boost C++ Libraries: Ticket #11035: BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE not defined for Android https://svn.boost.org/trac10/ticket/11035 <p> I'm using boost::recursive_mutex under Android and I noticed they don't work as expected, they are working like standard mutex. </p> <p> After further investigation, I noticed BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE and BOOST_PTHREAD_HAS_TIMEDLOCK were not defined for Android because Android NDK don't declare _POSIX_TIMEOUTS neither _XOPEN_SOURCE that are checked in boost. So boost::recursive_mutex are not recursive at all under Android :( </p> <p> Also pthread_mutex_timedlock signature changed since Android 5.0 (API 21), the version with the const struct is used from API 21 while previous versions were using the same without the const. </p> <p> from API 3 to 20: int pthread_mutex_timedlock(pthread_mutex_t *mutex, struct timespec* ts); </p> <p> from API 21: int pthread_mutex_timedlock(pthread_mutex_t*, const struct timespec*) <span class="underline">nonnull((1, 2)); </span></p> <p> I have some patches to fix these issues :) </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11035 Trac 1.4.3 kervala@… Mon, 16 Feb 2015 15:42:59 GMT attachment set https://svn.boost.org/trac10/ticket/11035 https://svn.boost.org/trac10/ticket/11035 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_recursive_mutex.patch</span> </li> </ul> <p> boost::recursive_mutex fix for Android </p> Ticket Cédric OCHS <kervala@…> Mon, 16 Feb 2015 15:53:51 GMT attachment set https://svn.boost.org/trac10/ticket/11035 https://svn.boost.org/trac10/ticket/11035 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_recursive_mutex.2.patch</span> </li> </ul> <p> Fix of the patch </p> Ticket Cédric OCHS <kervala@…> Mon, 16 Feb 2015 16:10:31 GMT <link>https://svn.boost.org/trac10/ticket/11035#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11035#comment:1</guid> <description> <p> Please ignore the first patch, I forgot to remove a #endif </p> </description> <category>Ticket</category> </item> <item> <author>Cédric OCHS <kervala@…></author> <pubDate>Mon, 16 Feb 2015 17:27:43 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/11035 https://svn.boost.org/trac10/ticket/11035 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_recursive_mutex.3.patch</span> </li> </ul> Ticket Cédric OCHS <kervala@…> Mon, 16 Feb 2015 17:33:01 GMT summary changed https://svn.boost.org/trac10/ticket/11035#comment:2 https://svn.boost.org/trac10/ticket/11035#comment:2 <ul> <li><strong>summary</strong> <span class="trac-field-old">BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE and BOOST_PTHREAD_HAS_TIMEDLOCK not defined for Android</span> → <span class="trac-field-new">BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE not defined for Android</span> </li> </ul> <p> I'm sorry, I didn't notice pthread_mutex_timedlock wasn't implemented in bionic before Android API 21, although it was defined in oldest ARM headers (a Google bug in this case). </p> <p> So I updated my patch for a 3rd time :) </p> Ticket viboes Thu, 19 Feb 2015 08:15:28 GMT owner changed https://svn.boost.org/trac10/ticket/11035#comment:3 https://svn.boost.org/trac10/ticket/11035#comment:3 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">Niall Douglas</span> </li> </ul> <p> Since which version of Android the 3rd patch is valid? </p> Ticket Cédric OCHS <kervala@…> Thu, 19 Feb 2015 08:27:49 GMT <link>https://svn.boost.org/trac10/ticket/11035#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11035#comment:4</guid> <description> <p> Thanks for your reply :) </p> <p> It's valid since Android API 3 (Android 1.5). </p> <p> I checked all pthread.h header from all Android versions supported by NDK. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Niall Douglas</dc:creator> <pubDate>Thu, 19 Feb 2015 15:08:20 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11035#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11035#comment:5</guid> <description> <p> Just for the record, I don't think Boost should support Android before v2. But thanks for the patch, this stuff is exactly why my client funded getting a regular CI going for Android. </p> </description> <category>Ticket</category> </item> <item> <author>Cédric OCHS <kervala@…></author> <pubDate>Thu, 19 Feb 2015 18:05:14 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11035#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11035#comment:6</guid> <description> <p> You're welcome :) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Thu, 19 Feb 2015 19:09:02 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11035#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11035#comment:7</guid> <description> <p> @Niall: if V2 is the minimal version, could this restriction be encoded on the config.hpp file. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 28 Feb 2015 21:42:26 GMT</pubDate> <title>owner, status changed https://svn.boost.org/trac10/ticket/11035#comment:8 https://svn.boost.org/trac10/ticket/11035#comment:8 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Niall Douglas</span> to <span class="trac-author">viboes</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> You should create a ticket and a patch for Boost Config (boost/config/posix_features.hpp). </p> <p> I will fix this soon. </p> Ticket viboes Sun, 01 Mar 2015 22:22:27 GMT milestone changed https://svn.boost.org/trac10/ticket/11035#comment:9 https://svn.boost.org/trac10/ticket/11035#comment:9 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.58.0</span> </li> </ul> <p> <a class="ext-link" href="https://github.com/boostorg/thread/commit/c7bb6fa318ddc27cb1ad9497f295db2744c0f069"><span class="icon">​</span>https://github.com/boostorg/thread/commit/c7bb6fa318ddc27cb1ad9497f295db2744c0f069</a> </p> Ticket viboes Sun, 08 Mar 2015 22:16:45 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/11035#comment:10 https://svn.boost.org/trac10/ticket/11035#comment:10 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket