3// Copyright (C) 2003-2022 Free Software Foundation, Inc.
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 3, or (at your option)
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
16// Under Section 7 of GPL version 3, you are granted additional
17// permissions described in the GCC Runtime Library Exception, version
18// 3.1, as published by the Free Software Foundation.
20// You should have received a copy of the GNU General Public License and
21// a copy of the GCC Runtime Library Exception along with this program;
22// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23// <http://www.gnu.org/licenses/>.
25/** @file include/mutex
26 * This is a Standard C++ Library header.
30#define _GLIBCXX_MUTEX 1
32#pragma GCC system_header
34#if __cplusplus < 201103L
35# include <bits/c++0x_warning.h>
41#include <system_error>
42#include <bits/chrono.h>
43#include <bits/std_mutex.h>
44#include <bits/unique_lock.h>
45#if ! _GTHREAD_USE_MUTEX_TIMEDLOCK
46# include <condition_variable>
49#include <ext/atomicity.h> // __gnu_cxx::__is_single_threaded
51#if defined _GLIBCXX_HAS_GTHREADS && ! defined _GLIBCXX_HAVE_TLS
52# include <bits/std_function.h> // std::function
55namespace std _GLIBCXX_VISIBILITY(default)
57_GLIBCXX_BEGIN_NAMESPACE_VERSION
64#ifdef _GLIBCXX_HAS_GTHREADS
66 // Common base class for std::recursive_mutex and std::recursive_timed_mutex
67 class __recursive_mutex_base
70 typedef __gthread_recursive_mutex_t __native_type;
72 __recursive_mutex_base(const __recursive_mutex_base&) = delete;
73 __recursive_mutex_base& operator=(const __recursive_mutex_base&) = delete;
75#ifdef __GTHREAD_RECURSIVE_MUTEX_INIT
76 __native_type _M_mutex = __GTHREAD_RECURSIVE_MUTEX_INIT;
78 __recursive_mutex_base() = default;
80 __native_type _M_mutex;
82 __recursive_mutex_base()
84 // XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may)
85 __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex);
88 ~__recursive_mutex_base()
89 { __gthread_recursive_mutex_destroy(&_M_mutex); }
93 /// The standard recursive mutex type.
94 class recursive_mutex : private __recursive_mutex_base
97 typedef __native_type* native_handle_type;
99 recursive_mutex() = default;
100 ~recursive_mutex() = default;
102 recursive_mutex(const recursive_mutex&) = delete;
103 recursive_mutex& operator=(const recursive_mutex&) = delete;
108 int __e = __gthread_recursive_mutex_lock(&_M_mutex);
110 // EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may)
112 __throw_system_error(__e);
118 // XXX EINVAL, EAGAIN, EBUSY
119 return !__gthread_recursive_mutex_trylock(&_M_mutex);
125 // XXX EINVAL, EAGAIN, EBUSY
126 __gthread_recursive_mutex_unlock(&_M_mutex);
130 native_handle() noexcept
131 { return &_M_mutex; }
134#if _GTHREAD_USE_MUTEX_TIMEDLOCK
135 template<typename _Derived>
136 class __timed_mutex_impl
139 template<typename _Rep, typename _Period>
141 _M_try_lock_for(const chrono::duration<_Rep, _Period>& __rtime)
143#if _GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK
144 using __clock = chrono::steady_clock;
146 using __clock = chrono::system_clock;
149 auto __rt = chrono::duration_cast<__clock::duration>(__rtime);
150 if (ratio_greater<__clock::period, _Period>())
152 return _M_try_lock_until(__clock::now() + __rt);
155 template<typename _Duration>
157 _M_try_lock_until(const chrono::time_point<chrono::system_clock,
160 auto __s = chrono::time_point_cast<chrono::seconds>(__atime);
161 auto __ns = chrono::duration_cast<chrono::nanoseconds>(__atime - __s);
163 __gthread_time_t __ts = {
164 static_cast<std::time_t>(__s.time_since_epoch().count()),
165 static_cast<long>(__ns.count())
168 return static_cast<_Derived*>(this)->_M_timedlock(__ts);
171#ifdef _GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK
172 template<typename _Duration>
174 _M_try_lock_until(const chrono::time_point<chrono::steady_clock,
177 auto __s = chrono::time_point_cast<chrono::seconds>(__atime);
178 auto __ns = chrono::duration_cast<chrono::nanoseconds>(__atime - __s);
180 __gthread_time_t __ts = {
181 static_cast<std::time_t>(__s.time_since_epoch().count()),
182 static_cast<long>(__ns.count())
185 return static_cast<_Derived*>(this)->_M_clocklock(CLOCK_MONOTONIC,
190 template<typename _Clock, typename _Duration>
192 _M_try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
194#if __cplusplus > 201703L
195 static_assert(chrono::is_clock_v<_Clock>);
197 // The user-supplied clock may not tick at the same rate as
198 // steady_clock, so we must loop in order to guarantee that
199 // the timeout has expired before returning false.
200 auto __now = _Clock::now();
202 auto __rtime = __atime - __now;
203 if (_M_try_lock_for(__rtime))
205 __now = _Clock::now();
206 } while (__atime > __now);
211 /// The standard timed mutex type.
213 : private __mutex_base, public __timed_mutex_impl<timed_mutex>
216 typedef __native_type* native_handle_type;
218 timed_mutex() = default;
219 ~timed_mutex() = default;
221 timed_mutex(const timed_mutex&) = delete;
222 timed_mutex& operator=(const timed_mutex&) = delete;
227 int __e = __gthread_mutex_lock(&_M_mutex);
229 // EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may)
231 __throw_system_error(__e);
237 // XXX EINVAL, EAGAIN, EBUSY
238 return !__gthread_mutex_trylock(&_M_mutex);
241 template <class _Rep, class _Period>
243 try_lock_for(const chrono::duration<_Rep, _Period>& __rtime)
244 { return _M_try_lock_for(__rtime); }
246 template <class _Clock, class _Duration>
248 try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
249 { return _M_try_lock_until(__atime); }
254 // XXX EINVAL, EAGAIN, EBUSY
255 __gthread_mutex_unlock(&_M_mutex);
259 native_handle() noexcept
260 { return &_M_mutex; }
263 friend class __timed_mutex_impl<timed_mutex>;
266 _M_timedlock(const __gthread_time_t& __ts)
267 { return !__gthread_mutex_timedlock(&_M_mutex, &__ts); }
269#if _GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK
271 _M_clocklock(clockid_t clockid, const __gthread_time_t& __ts)
272 { return !pthread_mutex_clocklock(&_M_mutex, clockid, &__ts); }
276 /// recursive_timed_mutex
277 class recursive_timed_mutex
278 : private __recursive_mutex_base,
279 public __timed_mutex_impl<recursive_timed_mutex>
282 typedef __native_type* native_handle_type;
284 recursive_timed_mutex() = default;
285 ~recursive_timed_mutex() = default;
287 recursive_timed_mutex(const recursive_timed_mutex&) = delete;
288 recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
293 int __e = __gthread_recursive_mutex_lock(&_M_mutex);
295 // EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may)
297 __throw_system_error(__e);
303 // XXX EINVAL, EAGAIN, EBUSY
304 return !__gthread_recursive_mutex_trylock(&_M_mutex);
307 template <class _Rep, class _Period>
309 try_lock_for(const chrono::duration<_Rep, _Period>& __rtime)
310 { return _M_try_lock_for(__rtime); }
312 template <class _Clock, class _Duration>
314 try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
315 { return _M_try_lock_until(__atime); }
320 // XXX EINVAL, EAGAIN, EBUSY
321 __gthread_recursive_mutex_unlock(&_M_mutex);
325 native_handle() noexcept
326 { return &_M_mutex; }
329 friend class __timed_mutex_impl<recursive_timed_mutex>;
332 _M_timedlock(const __gthread_time_t& __ts)
333 { return !__gthread_recursive_mutex_timedlock(&_M_mutex, &__ts); }
335#ifdef _GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK
337 _M_clocklock(clockid_t clockid, const __gthread_time_t& __ts)
338 { return !pthread_mutex_clocklock(&_M_mutex, clockid, &__ts); }
342#else // !_GTHREAD_USE_MUTEX_TIMEDLOCK
348 condition_variable _M_cv;
349 bool _M_locked = false;
353 timed_mutex() = default;
354 ~timed_mutex() { __glibcxx_assert( !_M_locked ); }
356 timed_mutex(const timed_mutex&) = delete;
357 timed_mutex& operator=(const timed_mutex&) = delete;
362 unique_lock<mutex> __lk(_M_mut);
363 _M_cv.wait(__lk, [&]{ return !_M_locked; });
370 lock_guard<mutex> __lk(_M_mut);
377 template<typename _Rep, typename _Period>
379 try_lock_for(const chrono::duration<_Rep, _Period>& __rtime)
381 unique_lock<mutex> __lk(_M_mut);
382 if (!_M_cv.wait_for(__lk, __rtime, [&]{ return !_M_locked; }))
388 template<typename _Clock, typename _Duration>
390 try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
392 unique_lock<mutex> __lk(_M_mut);
393 if (!_M_cv.wait_until(__lk, __atime, [&]{ return !_M_locked; }))
402 lock_guard<mutex> __lk(_M_mut);
403 __glibcxx_assert( _M_locked );
409 /// recursive_timed_mutex
410 class recursive_timed_mutex
413 condition_variable _M_cv;
415 unsigned _M_count = 0;
417 // Predicate type that tests whether the current thread can lock a mutex.
420 // Returns true if the mutex is unlocked or is locked by _M_caller.
422 operator()() const noexcept
423 { return _M_mx->_M_count == 0 || _M_mx->_M_owner == _M_caller; }
425 const recursive_timed_mutex* _M_mx;
426 thread::id _M_caller;
431 recursive_timed_mutex() = default;
432 ~recursive_timed_mutex() { __glibcxx_assert( _M_count == 0 ); }
434 recursive_timed_mutex(const recursive_timed_mutex&) = delete;
435 recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
440 auto __id = this_thread::get_id();
441 _Can_lock __can_lock{this, __id};
442 unique_lock<mutex> __lk(_M_mut);
443 _M_cv.wait(__lk, __can_lock);
445 __throw_system_error(EAGAIN); // [thread.timedmutex.recursive]/3
453 auto __id = this_thread::get_id();
454 _Can_lock __can_lock{this, __id};
455 lock_guard<mutex> __lk(_M_mut);
465 template<typename _Rep, typename _Period>
467 try_lock_for(const chrono::duration<_Rep, _Period>& __rtime)
469 auto __id = this_thread::get_id();
470 _Can_lock __can_lock{this, __id};
471 unique_lock<mutex> __lk(_M_mut);
472 if (!_M_cv.wait_for(__lk, __rtime, __can_lock))
481 template<typename _Clock, typename _Duration>
483 try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
485 auto __id = this_thread::get_id();
486 _Can_lock __can_lock{this, __id};
487 unique_lock<mutex> __lk(_M_mut);
488 if (!_M_cv.wait_until(__lk, __atime, __can_lock))
500 lock_guard<mutex> __lk(_M_mut);
501 __glibcxx_assert( _M_owner == this_thread::get_id() );
502 __glibcxx_assert( _M_count > 0 );
512#endif // _GLIBCXX_HAS_GTHREADS
514 /// @cond undocumented
517 // Lock the last lockable, after all previous ones are locked.
518 template<typename _Lockable>
520 __try_lock_impl(_Lockable& __l)
522 if (unique_lock<_Lockable> __lock{__l, try_to_lock})
531 // Lock each lockable in turn.
532 // Use iteration if all lockables are the same type, recursion otherwise.
533 template<typename _L0, typename... _Lockables>
535 __try_lock_impl(_L0& __l0, _Lockables&... __lockables)
537#if __cplusplus >= 201703L
538 if constexpr ((is_same_v<_L0, _Lockables> && ...))
540 constexpr int _Np = 1 + sizeof...(_Lockables);
541 unique_lock<_L0> __locks[_Np] = {
542 {__l0, defer_lock}, {__lockables, defer_lock}...
544 for (int __i = 0; __i < _Np; ++__i)
546 if (!__locks[__i].try_lock())
548 const int __failed = __i;
550 __locks[__i].unlock();
554 for (auto& __l : __locks)
560 if (unique_lock<_L0> __lock{__l0, try_to_lock})
562 int __idx = __detail::__try_lock_impl(__lockables...);
574 } // namespace __detail
577 /** @brief Generic try_lock.
578 * @param __l1 Meets Lockable requirements (try_lock() may throw).
579 * @param __l2 Meets Lockable requirements (try_lock() may throw).
580 * @param __l3 Meets Lockable requirements (try_lock() may throw).
581 * @return Returns -1 if all try_lock() calls return true. Otherwise returns
582 * a 0-based index corresponding to the argument that returned false.
583 * @post Either all arguments are locked, or none will be.
585 * Sequentially calls try_lock() on each argument.
587 template<typename _L1, typename _L2, typename... _L3>
589 try_lock(_L1& __l1, _L2& __l2, _L3&... __l3)
591 return __detail::__try_lock_impl(__l1, __l2, __l3...);
594 /// @cond undocumented
597 // This function can recurse up to N levels deep, for N = 1+sizeof...(L1).
598 // On each recursion the lockables are rotated left one position,
599 // e.g. depth 0: l0, l1, l2; depth 1: l1, l2, l0; depth 2: l2, l0, l1.
600 // When a call to l_i.try_lock() fails it recurses/returns to depth=i
601 // so that l_i is the first argument, and then blocks until l_i is locked.
602 template<typename _L0, typename... _L1>
604 __lock_impl(int& __i, int __depth, _L0& __l0, _L1&... __l1)
606 while (__i >= __depth)
610 int __failed = 1; // index that couldn't be locked
612 unique_lock<_L0> __first(__l0);
613 __failed += __detail::__try_lock_impl(__l1...);
616 __i = -1; // finished
621#if defined _GLIBCXX_HAS_GTHREADS && defined _GLIBCXX_USE_SCHED_YIELD
624 constexpr auto __n = 1 + sizeof...(_L1);
625 __i = (__depth + __failed) % __n;
627 else // rotate left until l_i is first.
628 __detail::__lock_impl(__i, __depth + 1, __l1..., __l0);
632 } // namespace __detail
635 /** @brief Generic lock.
636 * @param __l1 Meets Lockable requirements (try_lock() may throw).
637 * @param __l2 Meets Lockable requirements (try_lock() may throw).
638 * @param __l3 Meets Lockable requirements (try_lock() may throw).
639 * @throw An exception thrown by an argument's lock() or try_lock() member.
640 * @post All arguments are locked.
642 * All arguments are locked via a sequence of calls to lock(), try_lock()
643 * and unlock(). If this function exits via an exception any locks that
644 * were obtained will be released.
646 template<typename _L1, typename _L2, typename... _L3>
648 lock(_L1& __l1, _L2& __l2, _L3&... __l3)
650#if __cplusplus >= 201703L
651 if constexpr (is_same_v<_L1, _L2> && (is_same_v<_L1, _L3> && ...))
653 constexpr int _Np = 2 + sizeof...(_L3);
654 unique_lock<_L1> __locks[] = {
655 {__l1, defer_lock}, {__l2, defer_lock}, {__l3, defer_lock}...
659 __locks[__first].lock();
660 for (int __j = 1; __j < _Np; ++__j)
662 const int __idx = (__first + __j) % _Np;
663 if (!__locks[__idx].try_lock())
665 for (int __k = __j; __k != 0; --__k)
666 __locks[(__first + __k - 1) % _Np].unlock();
671 } while (!__locks[__first].owns_lock());
673 for (auto& __l : __locks)
680 __detail::__lock_impl(__i, 0, __l1, __l2, __l3...);
684#if __cplusplus >= 201703L
685#define __cpp_lib_scoped_lock 201703L
686 /** @brief A scoped lock type for multiple lockable objects.
688 * A scoped_lock controls mutex ownership within a scope, releasing
689 * ownership in the destructor.
691 template<typename... _MutexTypes>
695 explicit scoped_lock(_MutexTypes&... __m) : _M_devices(std::tie(__m...))
696 { std::lock(__m...); }
698 explicit scoped_lock(adopt_lock_t, _MutexTypes&... __m) noexcept
699 : _M_devices(std::tie(__m...))
700 { } // calling thread owns mutex
703 { std::apply([](auto&... __m) { (__m.unlock(), ...); }, _M_devices); }
705 scoped_lock(const scoped_lock&) = delete;
706 scoped_lock& operator=(const scoped_lock&) = delete;
709 tuple<_MutexTypes&...> _M_devices;
716 explicit scoped_lock() = default;
717 explicit scoped_lock(adopt_lock_t) noexcept { }
718 ~scoped_lock() = default;
720 scoped_lock(const scoped_lock&) = delete;
721 scoped_lock& operator=(const scoped_lock&) = delete;
724 template<typename _Mutex>
725 class scoped_lock<_Mutex>
728 using mutex_type = _Mutex;
730 explicit scoped_lock(mutex_type& __m) : _M_device(__m)
731 { _M_device.lock(); }
733 explicit scoped_lock(adopt_lock_t, mutex_type& __m) noexcept
735 { } // calling thread owns mutex
738 { _M_device.unlock(); }
740 scoped_lock(const scoped_lock&) = delete;
741 scoped_lock& operator=(const scoped_lock&) = delete;
744 mutex_type& _M_device;
748#ifdef _GLIBCXX_HAS_GTHREADS
749 /// Flag type used by std::call_once
752 constexpr once_flag() noexcept = default;
754 /// Deleted copy constructor
755 once_flag(const once_flag&) = delete;
756 /// Deleted assignment operator
757 once_flag& operator=(const once_flag&) = delete;
760 // For gthreads targets a pthread_once_t is used with pthread_once, but
761 // for most targets this doesn't work correctly for exceptional executions.
762 __gthread_once_t _M_once = __GTHREAD_ONCE_INIT;
764 struct _Prepare_execution;
766 template<typename _Callable, typename... _Args>
768 call_once(once_flag& __once, _Callable&& __f, _Args&&... __args);
771 /// @cond undocumented
772# ifdef _GLIBCXX_HAVE_TLS
773 // If TLS is available use thread-local state for the type-erased callable
774 // that is being run by std::call_once in the current thread.
775 extern __thread void* __once_callable;
776 extern __thread void (*__once_call)();
778 // RAII type to set up state for pthread_once call.
779 struct once_flag::_Prepare_execution
781 template<typename _Callable>
783 _Prepare_execution(_Callable& __c)
785 // Store address in thread-local pointer:
786 __once_callable = std::__addressof(__c);
787 // Trampoline function to invoke the closure via thread-local pointer:
788 __once_call = [] { (*static_cast<_Callable*>(__once_callable))(); };
791 ~_Prepare_execution()
793 // PR libstdc++/82481
794 __once_callable = nullptr;
795 __once_call = nullptr;
798 _Prepare_execution(const _Prepare_execution&) = delete;
799 _Prepare_execution& operator=(const _Prepare_execution&) = delete;
803 // Without TLS use a global std::mutex and store the callable in a
804 // global std::function.
805 extern function<void()> __once_functor;
808 __set_once_functor_lock_ptr(unique_lock<mutex>*);
813 // RAII type to set up state for pthread_once call.
814 struct once_flag::_Prepare_execution
816 template<typename _Callable>
818 _Prepare_execution(_Callable& __c)
820 // Store the callable in the global std::function
821 __once_functor = __c;
822 __set_once_functor_lock_ptr(&_M_functor_lock);
825 ~_Prepare_execution()
828 __set_once_functor_lock_ptr(nullptr);
832 // XXX This deadlocks if used recursively (PR 97949)
833 unique_lock<mutex> _M_functor_lock{__get_once_mutex()};
835 _Prepare_execution(const _Prepare_execution&) = delete;
836 _Prepare_execution& operator=(const _Prepare_execution&) = delete;
841 // This function is passed to pthread_once by std::call_once.
842 // It runs __once_call() or __once_functor().
843 extern "C" void __once_proxy(void);
845 /// Invoke a callable and synchronize with other calls using the same flag
846 template<typename _Callable, typename... _Args>
848 call_once(once_flag& __once, _Callable&& __f, _Args&&... __args)
850 // Closure type that runs the function
851 auto __callable = [&] {
852 std::__invoke(std::forward<_Callable>(__f),
853 std::forward<_Args>(__args)...);
856 once_flag::_Prepare_execution __exec(__callable);
858 // XXX pthread_once does not reset the flag if an exception is thrown.
859 if (int __e = __gthread_once(&__once._M_once, &__once_proxy))
860 __throw_system_error(__e);
863#else // _GLIBCXX_HAS_GTHREADS
865 /// Flag type used by std::call_once
868 constexpr once_flag() noexcept = default;
870 /// Deleted copy constructor
871 once_flag(const once_flag&) = delete;
872 /// Deleted assignment operator
873 once_flag& operator=(const once_flag&) = delete;
876 // There are two different std::once_flag interfaces, abstracting four
877 // different implementations.
878 // The single-threaded interface uses the _M_activate() and _M_finish(bool)
879 // functions, which start and finish an active execution respectively.
880 // See [thread.once.callonce] in C++11 for the definition of
881 // active/passive/returning/exceptional executions.
882 enum _Bits : int { _Init = 0, _Active = 1, _Done = 2 };
884 int _M_once = _Bits::_Init;
886 // Check to see if all executions will be passive now.
888 _M_passive() const noexcept;
890 // Attempts to begin an active execution.
893 // Must be called to complete an active execution.
894 // The argument is true if the active execution was a returning execution,
895 // false if it was an exceptional execution.
896 void _M_finish(bool __returning) noexcept;
898 // RAII helper to call _M_finish.
899 struct _Active_execution
901 explicit _Active_execution(once_flag& __flag) : _M_flag(__flag) { }
903 ~_Active_execution() { _M_flag._M_finish(_M_returning); }
905 _Active_execution(const _Active_execution&) = delete;
906 _Active_execution& operator=(const _Active_execution&) = delete;
909 bool _M_returning = false;
912 template<typename _Callable, typename... _Args>
914 call_once(once_flag& __once, _Callable&& __f, _Args&&... __args);
917 // Inline definitions of std::once_flag members for single-threaded targets.
920 once_flag::_M_passive() const noexcept
921 { return _M_once == _Bits::_Done; }
924 once_flag::_M_activate()
926 if (_M_once == _Bits::_Init) [[__likely__]]
928 _M_once = _Bits::_Active;
931 else if (_M_passive()) // Caller should have checked this already.
934 __throw_system_error(EDEADLK);
938 once_flag::_M_finish(bool __returning) noexcept
939 { _M_once = __returning ? _Bits::_Done : _Bits::_Init; }
941 /// Invoke a callable and synchronize with other calls using the same flag
942 template<typename _Callable, typename... _Args>
944 call_once(once_flag& __once, _Callable&& __f, _Args&&... __args)
946 if (__once._M_passive())
948 else if (__once._M_activate())
950 once_flag::_Active_execution __exec(__once);
952 // _GLIBCXX_RESOLVE_LIB_DEFECTS
953 // 2442. call_once() shouldn't DECAY_COPY()
954 std::__invoke(std::forward<_Callable>(__f),
955 std::forward<_Args>(__args)...);
957 // __f(__args...) did not throw
958 __exec._M_returning = true;
961#endif // _GLIBCXX_HAS_GTHREADS
964_GLIBCXX_END_NAMESPACE_VERSION
969#endif // _GLIBCXX_MUTEX