+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.
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:
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
wait(__lock);
}
- template<typename _Duration>
- bool
- timed_wait(unique_lock<mutex>& __lock, const _Duration& __rtime);
-
- bool
- timed_wait(unique_lock<mutex>& __lock, const system_time& __atime);
-
- template<typename _Predicate>
- bool
- timed_wait(unique_lock<mutex>& __lock, const system_time& __atime,
- _Predicate pred);
-
- template<typename _Duration, typename _Predicate>
+ template<typename _Clock, typename _Duration>
bool
- timed_wait(unique_lock<mutex>& __lock, const _Duration& __rtime,
- _Predicate pred);
+ wait_until(unique_lock<mutex>& __lock,
+ const chrono::time_point<_Clock, _Duration>& __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 _Rep, typename _Period>
+ bool
+ wait_for(unique_lock<mutex>& __lock,
+ const chrono::duration<_Rep, _Period>& __rtime);
+
+ 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; }
void
wait(_Lock& __lock, _Predicate __p);
- template<typename _Lock>
- bool
- timed_wait(_Lock& __lock, const system_time& __atime);
-
- template<typename _Lock, typename _Duration>
- bool
- timed_wait(_Lock& __lock, const _Duration& __rtime);
-
- template<typename _Lock, typename _Predicate>
+ template<typename _Lock, typename _Clock, typename _Duration>
bool
- timed_wait(_Lock& __lock, const system_time& __atime, _Predicate __p);
+ wait_until(_Lock& __lock,
+ const chrono::time_point<_Clock, _Duration>& __atime);
- template<typename _Lock, typename _Duration, typename _Predicate>
+ template<typename _Lock, typename _Clock,
+ typename _Duration, typename _Predicate>
bool
- timed_wait(_Lock& __lock, const _Duration& __rtime, _Predicate __p);
+ 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 _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; }
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
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
mutex& operator=(const mutex&);
};
-
/// recursive_mutex
class recursive_mutex
{
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
}
native_handle_type
- native_handle() { return _M_mutex; }
+ native_handle()
+ { return _M_mutex; }
private:
native_handle_type _M_mutex;
recursive_mutex& operator=(const recursive_mutex&);
};
+ /// timed_mutex
+ class 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();
- // class timed_mutex;
- // class recursive_timed_mutex;
+ 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 { };
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)
// 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()
{
unique_lock& operator=(unique_lock&&);
-
void
lock()
{
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);
}
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