mirror of git://gcc.gnu.org/git/gcc.git
fix darwin bootstrap errors due to <mutex>.
PR libstdc++/65704 * include/std/mutex (recursive_timed_mutex): Fix uses of _Can_lock. From-SVN: r227495
This commit is contained in:
parent
075e268e81
commit
c79c59f024
|
|
@ -1,4 +1,7 @@
|
||||||
2015-09-03 Jonathan Wakely <jwakely@redhat.com>
|
2015-09-04 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
PR libstdc++/65704
|
||||||
|
* include/std/mutex (recursive_timed_mutex): Fix uses of _Can_lock.
|
||||||
|
|
||||||
PR libstdc++/65704
|
PR libstdc++/65704
|
||||||
* include/Makefile.am: Add <bits/mutex.h>.
|
* include/Makefile.am: Add <bits/mutex.h>.
|
||||||
|
|
|
||||||
|
|
@ -368,9 +368,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
// Predicate type that tests whether the current thread can lock a mutex.
|
// Predicate type that tests whether the current thread can lock a mutex.
|
||||||
struct _Can_lock
|
struct _Can_lock
|
||||||
{
|
{
|
||||||
_Can_lock(const recursive_timed_mutex* __mx)
|
|
||||||
: _M_mx(__mx), _M_caller(this_thread::get_id()) { }
|
|
||||||
|
|
||||||
// Returns true if the mutex is unlocked or is locked by _M_caller.
|
// Returns true if the mutex is unlocked or is locked by _M_caller.
|
||||||
bool
|
bool
|
||||||
operator()() const noexcept
|
operator()() const noexcept
|
||||||
|
|
@ -391,7 +388,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
void
|
void
|
||||||
lock()
|
lock()
|
||||||
{
|
{
|
||||||
_Can_lock __can_lock{this};
|
auto __id = this_thread::get_id();
|
||||||
|
_Can_lock __can_lock{this, __id};
|
||||||
unique_lock<mutex> __lk(_M_mut);
|
unique_lock<mutex> __lk(_M_mut);
|
||||||
_M_cv.wait(__lk, __can_lock);
|
_M_cv.wait(__lk, __can_lock);
|
||||||
if (_M_count == -1u)
|
if (_M_count == -1u)
|
||||||
|
|
@ -403,7 +401,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
bool
|
bool
|
||||||
try_lock()
|
try_lock()
|
||||||
{
|
{
|
||||||
_Can_lock __can_lock{this};
|
auto __id = this_thread::get_id();
|
||||||
|
_Can_lock __can_lock{this, __id};
|
||||||
lock_guard<mutex> __lk(_M_mut);
|
lock_guard<mutex> __lk(_M_mut);
|
||||||
if (!__can_lock())
|
if (!__can_lock())
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -418,9 +417,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
bool
|
bool
|
||||||
try_lock_for(const chrono::duration<_Rep, _Period>& __rtime)
|
try_lock_for(const chrono::duration<_Rep, _Period>& __rtime)
|
||||||
{
|
{
|
||||||
_Can_lock __can_lock{this};
|
auto __id = this_thread::get_id();
|
||||||
|
_Can_lock __can_lock{this, __id};
|
||||||
unique_lock<mutex> __lk(_M_mut);
|
unique_lock<mutex> __lk(_M_mut);
|
||||||
if (!_M_cv.wait_for(__lk, __rtime, __can_lock);
|
if (!_M_cv.wait_for(__lk, __rtime, __can_lock))
|
||||||
return false;
|
return false;
|
||||||
if (_M_count == -1u)
|
if (_M_count == -1u)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -433,9 +433,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
bool
|
bool
|
||||||
try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
|
try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime)
|
||||||
{
|
{
|
||||||
_Can_lock __can_lock{this};
|
auto __id = this_thread::get_id();
|
||||||
|
_Can_lock __can_lock{this, __id};
|
||||||
unique_lock<mutex> __lk(_M_mut);
|
unique_lock<mutex> __lk(_M_mut);
|
||||||
if (!_M_cv.wait_until(__lk, __atime, __can_lock);
|
if (!_M_cv.wait_until(__lk, __atime, __can_lock))
|
||||||
return false;
|
return false;
|
||||||
if (_M_count == -1u)
|
if (_M_count == -1u)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue