This paper studies possible changes to the Threads Library to make broad use of noexcept. The paper addresses National Body comments CH 16 and GB 60.
Changes in this paper are restricted to chapter 30 (threads library).
All changes in this paper are relative to N3225.
Several swap() functions have been made noexcept as the are defined in terms of the corresponding noexcept member function.
In 30.4.1 mutex, recursive_mutex, timed_mutex and recursive_timed_mutex constructors have been made noexcept In section 30.6.1 some operations have been made noexcept to be consistent with the disgnostics library. In section 30.6.10 member function valid is not consistent with its definition in 30.6.10.1. It has been updated.
namespace std { #define __STDCPP_THREADS__ __cplusplus class thread; void swap(thread& x, thread& y) noexcept; namespace this_thread { thread::id get_id() noexcept; void yield() noexcept; template <class Clock, class Duration> void sleep_until(const chrono::time_point<Clock, Duration>& abs_time) noexcept; template <class Rep, class Period> void sleep_for(const chrono::duration<Rep, Period>& rel_time) noexcept; } }
void swap(thread& x, thread& y) noexcept;
namespace std { class mutex { public: constexpr mutex() noexcept; ~mutex(); mutex(const mutex&) = delete; mutex& operator=(const mutex&) = delete; void lock(); bool try_lock() noexcept; void unlock() noexcept; typedef implementation-defined native_handle_type; // See 30.2.3 native_handle_type native_handle(); // See 30.2.3 }; }
namespace std { class recursive_mutex { public: recursive_mutex() noexcept; ~recursive_mutex(); recursive_mutex(const recursive_mutex&) = delete; recursive_mutex& operator=(const recursive_mutex&) = delete; void lock(); bool try_lock() noexcept; void unlock() noexcept; typedef implementation-defined native_handle_type; // See 30.2.3 native_handle_type native_handle(); // See 30.2.3 }; }
namespace std { class timed_mutex { public: timed_mutex() noexcept; ~timed_mutex(); timed_mutex(const timed_mutex&) = delete; timed_mutex& operator=(const timed_mutex&) = delete; void lock(); bool try_lock(); template <class Rep, class Period> bool try_lock_for(const chrono::duration<Rep, Period>& rel_time) noexcept; template <class Clock, class Duration> bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time) noexcept; void unlock(); typedef implementation-defined native_handle_type; // See 30.2.3 native_handle_type native_handle(); // See 30.2.3 }; }
namespace std { class recursive_timed_mutex { public: recursive_timed_mutex() noexcept; ~recursive_timed_mutex(); recursive_timed_mutex(const recursive_timed_mutex&) = delete; recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete; void lock(); bool try_lock(); template <class Rep, class Period> bool try_lock_for(const chrono::duration<Rep, Period>& rel_time) noexcept; template <class Clock, class Duration> bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time) noexcept; void unlock(); typedef implementation-defined native_handle_type; // See 30.2.3 native_handle_type native_handle(); // See 30.2.3 }; }
const error_category& future_category() noexcept;After p. 2
error_code make_error_code(future_errc e) noexcept;After p. 3
error_condition make_error_condition(future_errc e) noexcept;
template <class R> void swap(promise<R>& x, promise<R>& y) noexcept;
namespace std { template<class R, class... ArgTypes> class packaged_task<R(ArgTypes...)> { public: ... bool valid() const noexcept; ...