[v3] libstdc++/50196 - enable std::thread, std::mutex etc. on darwin

Jonathan Wakely jwakely.gcc@gmail.com
Fri Oct 21 19:39:00 GMT 2011


On 21 October 2011 09:15, Jonathan Wakely wrote:
> On 21 October 2011 00:43, Jonathan Wakely wrote:
>> This patch should enable macosx support for <thread> and partial
>> support for <mutex>, by defining _GLIBCXX_HAS_GTHREADS on POSIX
>> systems without the _POSIX_TIMEOUTS option, and only disabling the
>> types which rely on the Timeouts option, std::timed_mutex and
>> std::recursive_timed_mutex, instead of disabling all thread support.
>
> I've just realised this patch will disable the timed mutexes on
> non-posix platforms - I should only check for _POSIX_TIMEOUTS when
> thread-model = posix, and set HAS_MUTEX_TIMEDLOCK unconditionally
> elsewhere.

Updated patch so that _GTHREADS_HAS_MUTEX_TIMED_LOCK is 1 for
non-posix systems and posix systems that support the Timeouts option.

Tested x86_64-linux.  I think this is OK now and plan to commit it
over the weekend.

        * acinclude.m4 (GLIBCXX_HAS_GTHREADS): Don't depend on _POSIX_TIMEOUTS.
        * configure: Regenerate.
        * include/std/mutex (timed_mutex, recursive_timed_mutex): Define
        conditionally on GTHREADS_HAS_MUTEX_TIMEDLOCK.
        * testsuite/lib/libstdc++.exp (check_v3_target_gthreads_timed): Define.
        * testsuite/lib/dg-options.exp (dg-require-gthreads-timed): Define.
        * testsuite/30_threads/recursive_timed_mutex/dest/destructor_locked.cc:
        Use dg-require-gthreads-timed instead of dg-require-gthreads.
        * testsuite/30_threads/recursive_timed_mutex/native_handle/
        typesizes.cc: Likewise.
        * testsuite/30_threads/recursive_timed_mutex/native_handle/1.cc:
        Likewise.
        * testsuite/30_threads/recursive_timed_mutex/try_lock_until/1.cc:
        Likewise.
        * testsuite/30_threads/recursive_timed_mutex/try_lock_until/2.cc:
        Likewise.
        * testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc:
        Likewise.
        * testsuite/30_threads/recursive_timed_mutex/cons/1.cc: Likewise.
        * testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc:
        Likewise.
        * testsuite/30_threads/recursive_timed_mutex/requirements/typedefs.cc:
        Likewise.
        * testsuite/30_threads/recursive_timed_mutex/try_lock/1.cc: Likewise.
        * testsuite/30_threads/recursive_timed_mutex/try_lock/2.cc: Likewise.
        * testsuite/30_threads/recursive_timed_mutex/lock/1.cc: Likewise.
        * testsuite/30_threads/recursive_timed_mutex/lock/2.cc: Likewise.
        * testsuite/30_threads/recursive_timed_mutex/unlock/1.cc: Likewise.
        * testsuite/30_threads/recursive_timed_mutex/try_lock_for/1.cc:
        Likewise.
        * testsuite/30_threads/recursive_timed_mutex/try_lock_for/2.cc:
        Likewise.
        * testsuite/30_threads/recursive_timed_mutex/try_lock_for/3.cc:
        Likewise.
        * testsuite/30_threads/timed_mutex/dest/destructor_locked.cc: Likewise.
        * testsuite/30_threads/timed_mutex/native_handle/typesizes.cc:
        Likewise.
        * testsuite/30_threads/timed_mutex/native_handle/1.cc: Likewise.
        * testsuite/30_threads/timed_mutex/try_lock_until/1.cc: Likewise.
        * testsuite/30_threads/timed_mutex/try_lock_until/2.cc: Likewise.
        * testsuite/30_threads/timed_mutex/cons/assign_neg.cc: Likewise.
        * testsuite/30_threads/timed_mutex/cons/1.cc: Likewise.
        * testsuite/30_threads/timed_mutex/cons/copy_neg.cc: Likewise.
        * testsuite/30_threads/timed_mutex/requirements/standard_layout.cc:
        Likewise.
        * testsuite/30_threads/timed_mutex/requirements/typedefs.cc: Likewise.
        * testsuite/30_threads/timed_mutex/try_lock/1.cc: Likewise.
        * testsuite/30_threads/timed_mutex/try_lock/2.cc: Likewise.
        * testsuite/30_threads/timed_mutex/lock/1.cc: Likewise.
        * testsuite/30_threads/timed_mutex/unlock/1.cc: Likewise.
        * testsuite/30_threads/timed_mutex/try_lock_for/1.cc: Likewise.
        * testsuite/30_threads/timed_mutex/try_lock_for/2.cc: Likewise.
        * testsuite/30_threads/timed_mutex/try_lock_for/3.cc: Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 50196.patch
Type: text/x-patch
Size: 32430 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20111021/0f5ae416/attachment.bin>


More information about the Libstdc++ mailing list