diff --git a/include/nana/audio/detail/buffer_preparation.hpp b/include/nana/audio/detail/buffer_preparation.hpp index 57e6f32e..7272d9b1 100644 --- a/include/nana/audio/detail/buffer_preparation.hpp +++ b/include/nana/audio/detail/buffer_preparation.hpp @@ -23,6 +23,8 @@ #include #endif +#include + namespace nana{ namespace audio { namespace detail @@ -52,8 +54,8 @@ namespace nana{ namespace audio private: void _m_prepare_routine(); private: - volatile bool running_; - volatile bool wait_for_buffer_; + std::atomic running_; + std::atomic wait_for_buffer_; std::thread thr_; mutable std::mutex token_buffer_, token_prepared_; mutable std::condition_variable cond_buffer_, cond_prepared_; diff --git a/include/nana/pat/cloneable.hpp b/include/nana/pat/cloneable.hpp index 350dbe1a..60d691f6 100644 --- a/include/nana/pat/cloneable.hpp +++ b/include/nana/pat/cloneable.hpp @@ -193,7 +193,7 @@ namespace nana{ namespace pat{ cwrapper_.reset(); } - operator operator_bool_t() const volatile noexcept + operator operator_bool_t() const noexcept { return (fast_ptr_ ? &inner_bool::true_stand : nullptr); } diff --git a/include/nana/system/timepiece.hpp b/include/nana/system/timepiece.hpp index fe188f45..248a798e 100644 --- a/include/nana/system/timepiece.hpp +++ b/include/nana/system/timepiece.hpp @@ -1,6 +1,6 @@ /* * Timepiece Implementation - * Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at @@ -21,11 +21,11 @@ namespace system { public: timepiece(); - timepiece(const volatile timepiece&); + timepiece(const timepiece&); ~timepiece(); - timepiece & operator=(const volatile timepiece &); - void start() volatile; ///< Set the begin time. - double calc() const volatile; ///< Get the intervals from the begin time. + timepiece & operator=(const timepiece &); + void start() noexcept; ///< Set the begin time. + double calc() const noexcept; ///< Get the intervals from the begin time. private: struct impl_t; impl_t * impl_; diff --git a/source/detail/posix/msg_dispatcher.hpp b/source/detail/posix/msg_dispatcher.hpp index 6bef753e..9ba12ad1 100644 --- a/source/detail/posix/msg_dispatcher.hpp +++ b/source/detail/posix/msg_dispatcher.hpp @@ -26,6 +26,7 @@ #include #include #include +#include namespace nana { @@ -340,7 +341,7 @@ namespace detail private: Display * display_; - volatile bool is_work_{ false }; + std::atomic is_work_{ false }; std::unique_ptr thrd_; struct table_tag diff --git a/source/detail/posix/platform_spec.hpp b/source/detail/posix/platform_spec.hpp index a4755370..3191ddb1 100644 --- a/source/detail/posix/platform_spec.hpp +++ b/source/detail/posix/platform_spec.hpp @@ -20,6 +20,7 @@ #include +#include #include #include #include @@ -268,7 +269,7 @@ namespace detail std::recursive_mutex xlib_locker_; struct caret_holder_tag { - volatile bool exit_thread; + std::atomic exit_thread; std::unique_ptr thr; std::map carets; }caret_holder_; diff --git a/source/system/timepiece.cpp b/source/system/timepiece.cpp index fb2f71b9..e8f98d24 100644 --- a/source/system/timepiece.cpp +++ b/source/system/timepiece.cpp @@ -24,7 +24,7 @@ namespace system : impl_(new impl_t) {} - timepiece::timepiece(const volatile timepiece& rhs) + timepiece::timepiece(const timepiece& rhs) : impl_(new impl_t(*rhs.impl_)) {} @@ -33,7 +33,7 @@ namespace system delete impl_; } - timepiece & timepiece::operator=(const volatile timepiece & rhs) + timepiece & timepiece::operator=(const timepiece & rhs) { if(this != &rhs) *impl_ = *rhs.impl_; @@ -41,7 +41,7 @@ namespace system return *this; } - void timepiece::start() volatile + void timepiece::start() noexcept { #if defined(NANA_WINDOWS) ::QueryPerformanceCounter(&impl_->beg_timestamp); @@ -51,7 +51,7 @@ namespace system #endif } - double timepiece::calc() const volatile + double timepiece::calc() const noexcept { #if defined(NANA_WINDOWS) LARGE_INTEGER li;