summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2015-09-04 16:09:05 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2015-09-04 16:09:05 +0000
commit26befabfb630f8cf2e27f140ff79a867e29dcdb9 (patch)
tree9d4916572cfb97a8c260f8d1873b388338b1e98e /libstdc++-v3
parent6af1d635447c364874a0c741d4704ea7549a439d (diff)
downloadgcc-26befabfb630f8cf2e27f140ff79a867e29dcdb9.tar.gz
fix darwin bootstrap errors due to <mutex>.
PR libstdc++/65704 * include/std/mutex (recursive_timed_mutex): Fix uses of _Can_lock. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227495 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/include/std/mutex19
2 files changed, 14 insertions, 10 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 030becbdbe6..ac2dde477af 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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
* include/Makefile.am: Add <bits/mutex.h>.
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index 47141d95477..38950b6e9e8 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -368,9 +368,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Predicate type that tests whether the current thread can lock a mutex.
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.
bool
operator()() const noexcept
@@ -391,7 +388,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void
lock()
{
- _Can_lock __can_lock{this};
+ auto __id = this_thread::get_id();
+ _Can_lock __can_lock{this, __id};
unique_lock<mutex> __lk(_M_mut);
_M_cv.wait(__lk, __can_lock);
if (_M_count == -1u)
@@ -403,7 +401,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
bool
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);
if (!__can_lock())
return false;
@@ -418,9 +417,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
bool
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);
- if (!_M_cv.wait_for(__lk, __rtime, __can_lock);
+ if (!_M_cv.wait_for(__lk, __rtime, __can_lock))
return false;
if (_M_count == -1u)
return false;
@@ -433,9 +433,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
bool
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);
- if (!_M_cv.wait_until(__lk, __atime, __can_lock);
+ if (!_M_cv.wait_until(__lk, __atime, __can_lock))
return false;
if (_M_count == -1u)
return false;