mirror of
https://gcc.gnu.org/git/gcc.git
synced 2025-01-17 09:13:49 +08:00
condition_variable: Update to N2691 WD.
2008-07-23 Chris Fairles <chris.fairles@gmail.com> * include/std/condition_variable: Update to N2691 WD. * include/std/mutex: Likewise. * testsuite/30_threads/mutex/cons/assign_neg.cc: Adjust line numbers. * testsuite/30_threads/mutex/cons/copy_neg.cc: Likewise. * testsuite/30_threads/recursive_mutex/cons/assign_neg.cc: Likewise. * testsuite/30_threads/recursive_mutex/cons/copy_neg.cc: Likewise. From-SVN: r138096
This commit is contained in:
parent
3e293154d6
commit
d3098c948b
@ -1,3 +1,12 @@
|
||||
2008-07-23 Chris Fairles <chris.fairles@gmail.com>
|
||||
|
||||
* include/std/condition_variable: Update to N2691 WD.
|
||||
* include/std/mutex: Likewise.
|
||||
* testsuite/30_threads/mutex/cons/assign_neg.cc: Adjust line numbers.
|
||||
* testsuite/30_threads/mutex/cons/copy_neg.cc: Likewise.
|
||||
* testsuite/30_threads/recursive_mutex/cons/assign_neg.cc: Likewise.
|
||||
* testsuite/30_threads/recursive_mutex/cons/copy_neg.cc: Likewise.
|
||||
|
||||
2008-07-23 Chris Fairles <chris.fairles@gmail.com>
|
||||
|
||||
* acinclude.m4 ([GLIBCXX_CHECK_CLOCK_GETTIME]): Define GLIBCXX_LIBS.
|
||||
@ -78,10 +87,10 @@
|
||||
Update error lineno.
|
||||
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
|
||||
Update error lineno.
|
||||
* testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc:
|
||||
Update error lineno.
|
||||
* testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc:
|
||||
Update error lineno.
|
||||
* testsuite/23_containers/vector/requirements/dr438/
|
||||
constructor_1_neg.cc: Update error lineno.
|
||||
* testsuite/23_containers/vector/requirements/dr438/
|
||||
constructor_2_neg.cc: Update error lineno.
|
||||
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
|
||||
Update error lineno.
|
||||
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
|
||||
|
@ -44,8 +44,14 @@
|
||||
|
||||
namespace std
|
||||
{
|
||||
// XXX
|
||||
class system_time;
|
||||
namespace chrono
|
||||
{
|
||||
template<typename _Rep, typename _Period>
|
||||
struct duration;
|
||||
|
||||
template<typename _Clock, typename _Duration>
|
||||
struct time_point;
|
||||
}
|
||||
|
||||
/// condition_variable
|
||||
class condition_variable
|
||||
@ -78,22 +84,27 @@ namespace std
|
||||
wait(__lock);
|
||||
}
|
||||
|
||||
template<typename _Duration>
|
||||
template<typename _Clock, typename _Duration>
|
||||
bool
|
||||
timed_wait(unique_lock<mutex>& __lock, const _Duration& __rtime);
|
||||
wait_until(unique_lock<mutex>& __lock,
|
||||
const chrono::time_point<_Clock, _Duration>& __atime);
|
||||
|
||||
bool
|
||||
timed_wait(unique_lock<mutex>& __lock, const system_time& __atime);
|
||||
template<typename _Clock, typename _Duration, typename _Predicate>
|
||||
bool
|
||||
wait_until(unique_lock<mutex>& __lock,
|
||||
const chrono::time_point<_Clock, _Duration>& __atime,
|
||||
_Predicate __p);
|
||||
|
||||
template<typename _Predicate>
|
||||
bool
|
||||
timed_wait(unique_lock<mutex>& __lock, const system_time& __atime,
|
||||
_Predicate pred);
|
||||
template<typename _Rep, typename _Period>
|
||||
bool
|
||||
wait_for(unique_lock<mutex>& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __rtime);
|
||||
|
||||
template<typename _Duration, typename _Predicate>
|
||||
bool
|
||||
timed_wait(unique_lock<mutex>& __lock, const _Duration& __rtime,
|
||||
_Predicate pred);
|
||||
template<typename _Rep, typename _Period, typename _Predicate>
|
||||
bool
|
||||
wait_for(unique_lock<mutex>& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __rtime,
|
||||
_Predicate __p);
|
||||
|
||||
native_handle_type
|
||||
native_handle() { return _M_cond; }
|
||||
@ -132,21 +143,27 @@ namespace std
|
||||
void
|
||||
wait(_Lock& __lock, _Predicate __p);
|
||||
|
||||
template<typename _Lock>
|
||||
template<typename _Lock, typename _Clock, typename _Duration>
|
||||
bool
|
||||
timed_wait(_Lock& __lock, const system_time& __atime);
|
||||
wait_until(_Lock& __lock,
|
||||
const chrono::time_point<_Clock, _Duration>& __atime);
|
||||
|
||||
template<typename _Lock, typename _Duration>
|
||||
template<typename _Lock, typename _Clock,
|
||||
typename _Duration, typename _Predicate>
|
||||
bool
|
||||
timed_wait(_Lock& __lock, const _Duration& __rtime);
|
||||
wait_until(_Lock& __lock,
|
||||
const chrono::time_point<_Clock, _Duration>& __atime,
|
||||
_Predicate __p);
|
||||
|
||||
template<typename _Lock, typename _Rep, typename _Period>
|
||||
bool
|
||||
wait_for(_Lock& __lock, const chrono::duration<_Rep, _Period>& __rtime);
|
||||
|
||||
template<typename _Lock, typename _Predicate>
|
||||
bool
|
||||
timed_wait(_Lock& __lock, const system_time& __atime, _Predicate __p);
|
||||
|
||||
template<typename _Lock, typename _Duration, typename _Predicate>
|
||||
bool
|
||||
timed_wait(_Lock& __lock, const _Duration& __rtime, _Predicate __p);
|
||||
template<typename _Lock, typename _Rep,
|
||||
typename _Period, typename _Predicate>
|
||||
bool
|
||||
wait_for(_Lock& __lock,
|
||||
const chrono::duration<_Rep, _Period>& __rtime, _Predicate __p);
|
||||
|
||||
native_handle_type
|
||||
native_handle() { return _M_cond; }
|
||||
|
@ -48,8 +48,14 @@
|
||||
|
||||
namespace std
|
||||
{
|
||||
// XXX
|
||||
class system_time;
|
||||
namespace chrono
|
||||
{
|
||||
template<typename _Rep, typename _Period>
|
||||
struct duration;
|
||||
|
||||
template<typename _Clock, typename _Duration>
|
||||
struct time_point;
|
||||
}
|
||||
|
||||
/// mutex
|
||||
class mutex
|
||||
@ -74,22 +80,22 @@ namespace std
|
||||
int __e = __gthread_mutex_lock(&_M_mutex);
|
||||
|
||||
// EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may)
|
||||
if (__e)
|
||||
__throw_system_error(__e);
|
||||
if (__e)
|
||||
__throw_system_error(__e);
|
||||
}
|
||||
|
||||
bool
|
||||
try_lock()
|
||||
{
|
||||
// XXX EINVAL, EAGAIN, EBUSY
|
||||
return !__gthread_mutex_trylock(&_M_mutex);
|
||||
// XXX EINVAL, EAGAIN, EBUSY
|
||||
return !__gthread_mutex_trylock(&_M_mutex);
|
||||
}
|
||||
|
||||
void
|
||||
unlock()
|
||||
{
|
||||
// XXX EINVAL, EAGAIN, EPERM
|
||||
__gthread_mutex_unlock(&_M_mutex);
|
||||
__gthread_mutex_unlock(&_M_mutex);
|
||||
}
|
||||
|
||||
native_handle_type
|
||||
@ -102,7 +108,6 @@ namespace std
|
||||
mutex& operator=(const mutex&);
|
||||
};
|
||||
|
||||
|
||||
/// recursive_mutex
|
||||
class recursive_mutex
|
||||
{
|
||||
@ -126,8 +131,8 @@ namespace std
|
||||
int __e = __gthread_recursive_mutex_lock(&_M_mutex);
|
||||
|
||||
// EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may)
|
||||
if (__e)
|
||||
__throw_system_error(__e);
|
||||
if (__e)
|
||||
__throw_system_error(__e);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -145,7 +150,8 @@ namespace std
|
||||
}
|
||||
|
||||
native_handle_type
|
||||
native_handle() { return _M_mutex; }
|
||||
native_handle()
|
||||
{ return _M_mutex; }
|
||||
|
||||
private:
|
||||
native_handle_type _M_mutex;
|
||||
@ -154,9 +160,65 @@ namespace std
|
||||
recursive_mutex& operator=(const recursive_mutex&);
|
||||
};
|
||||
|
||||
/// timed_mutex
|
||||
class timed_mutex
|
||||
{
|
||||
public:
|
||||
typedef __gthread_mutex_t native_handle_type;
|
||||
|
||||
// class timed_mutex;
|
||||
// class recursive_timed_mutex;
|
||||
void lock();
|
||||
bool try_lock();
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
bool
|
||||
try_lock_for(const chrono::duration<_Rep, _Period>& __rtime);
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
bool
|
||||
try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime);
|
||||
|
||||
void unlock();
|
||||
|
||||
native_handle_type
|
||||
native_handle()
|
||||
{ return _M_mutex; }
|
||||
|
||||
private:
|
||||
native_handle_type _M_mutex;
|
||||
|
||||
timed_mutex(const timed_mutex&);
|
||||
timed_mutex& operator=(const timed_mutex&);
|
||||
};
|
||||
|
||||
/// recursive_timed_mutex
|
||||
class recursive_timed_mutex
|
||||
{
|
||||
public:
|
||||
typedef __gthread_mutex_t native_handle_type;
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
bool
|
||||
try_lock_for(const chrono::duration<_Rep, _Period>& __rtime);
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
bool
|
||||
try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime);
|
||||
|
||||
void unlock();
|
||||
|
||||
native_handle_type
|
||||
native_handle()
|
||||
{ return _M_mutex; }
|
||||
|
||||
private:
|
||||
native_handle_type _M_mutex;
|
||||
|
||||
recursive_timed_mutex(const recursive_timed_mutex&);
|
||||
recursive_timed_mutex& operator=(const recursive_timed_mutex&);
|
||||
};
|
||||
|
||||
/// Do not acquire ownership of the mutex.
|
||||
struct defer_lock_t { };
|
||||
@ -211,19 +273,24 @@ namespace std
|
||||
public:
|
||||
typedef _Mutex mutex_type;
|
||||
|
||||
unique_lock() : _M_device(NULL), _M_owns(false) { }
|
||||
unique_lock()
|
||||
: _M_device(NULL), _M_owns(false)
|
||||
{ }
|
||||
|
||||
explicit unique_lock(mutex_type& __m) : _M_device(&__m)
|
||||
explicit unique_lock(mutex_type& __m)
|
||||
: _M_device(&__m)
|
||||
{
|
||||
lock();
|
||||
_M_owns = true;
|
||||
}
|
||||
|
||||
unique_lock(mutex_type& __m, defer_lock_t)
|
||||
: _M_device(&__m), _M_owns(false) { }
|
||||
: _M_device(&__m), _M_owns(false)
|
||||
{ }
|
||||
|
||||
unique_lock(mutex_type& __m, try_to_lock_t)
|
||||
: _M_device(&__m), _M_owns(_M_device->try_lock()) { }
|
||||
: _M_device(&__m), _M_owns(_M_device->try_lock())
|
||||
{ }
|
||||
|
||||
unique_lock(mutex_type& __m, adopt_lock_t)
|
||||
: _M_device(&__m), _M_owns(true)
|
||||
@ -231,10 +298,13 @@ namespace std
|
||||
// XXX calling thread owns mutex
|
||||
}
|
||||
|
||||
unique_lock(mutex_type& __m, const system_time& abs_time);
|
||||
template<typename _Clock, typename _Duration>
|
||||
unique_lock(mutex_type& __m,
|
||||
const chrono::time_point<_Clock, _Duration>& __atime);
|
||||
|
||||
template<typename _Duration>
|
||||
unique_lock(mutex_type& __m, const _Duration& rel_time);
|
||||
template<typename _Rep, typename _Period>
|
||||
unique_lock(mutex_type& __m,
|
||||
const chrono::duration<_Rep, _Period>& __rtime);
|
||||
|
||||
~unique_lock()
|
||||
{
|
||||
@ -246,7 +316,6 @@ namespace std
|
||||
|
||||
unique_lock& operator=(unique_lock&&);
|
||||
|
||||
|
||||
void
|
||||
lock()
|
||||
{
|
||||
@ -276,12 +345,13 @@ namespace std
|
||||
throw lock_error();
|
||||
}
|
||||
|
||||
template<typename _Rep, typename _Period>
|
||||
bool
|
||||
try_lock_for(const chrono::duration<_Rep, _Period>& __rtime);
|
||||
|
||||
template<typename _Duration>
|
||||
bool timed_lock(const _Duration& rel_time);
|
||||
|
||||
bool
|
||||
timed_lock(const system_time& abs_time);
|
||||
template<typename _Clock, typename _Duration>
|
||||
bool
|
||||
try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime);
|
||||
|
||||
void
|
||||
swap(unique_lock&& __u);
|
||||
@ -296,9 +366,11 @@ namespace std
|
||||
}
|
||||
|
||||
bool
|
||||
owns_lock() const { return _M_owns; }
|
||||
owns_lock() const
|
||||
{ return _M_owns; }
|
||||
|
||||
operator bool () const { return owns_lock(); }
|
||||
operator bool () const
|
||||
{ return owns_lock(); }
|
||||
|
||||
mutex_type*
|
||||
mutex() const
|
||||
|
@ -39,4 +39,4 @@ void test01()
|
||||
m1 = m2;
|
||||
}
|
||||
// { dg-error "within this context" "" { target *-*-* } 39 }
|
||||
// { dg-error "is private" "" { target *-*-* } 102 }
|
||||
// { dg-error "is private" "" { target *-*-* } 108 }
|
||||
|
@ -38,4 +38,4 @@ void test01()
|
||||
mutex_type m2(m1);
|
||||
}
|
||||
// { dg-error "within this context" "" { target *-*-* } 38 }
|
||||
// { dg-error "is private" "" { target *-*-* } 101 }
|
||||
// { dg-error "is private" "" { target *-*-* } 107 }
|
||||
|
@ -39,4 +39,4 @@ void test01()
|
||||
m1 = m2;
|
||||
}
|
||||
// { dg-error "within this context" "" { target *-*-* } 39 }
|
||||
// { dg-error "is private" "" { target *-*-* } 154 }
|
||||
// { dg-error "is private" "" { target *-*-* } 160 }
|
||||
|
@ -38,4 +38,4 @@ void test01()
|
||||
mutex_type m2(m1);
|
||||
}
|
||||
// { dg-error "within this context" "" { target *-*-* } 38 }
|
||||
// { dg-error "is private" "" { target *-*-* } 153 }
|
||||
// { dg-error "is private" "" { target *-*-* } 159 }
|
||||
|
Loading…
Reference in New Issue
Block a user