From 7fe3c623290a3f17d37241748410c8484a326483 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 18 Mar 2022 16:13:04 +0100 Subject: thread.hpp: Fix redefinition of default argument A default argument shall be defined only once. Close #4632. --- cpukit/include/rtems/thread.hpp | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'cpukit/include/rtems') diff --git a/cpukit/include/rtems/thread.hpp b/cpukit/include/rtems/thread.hpp index cdef690740..56e301c0bc 100644 --- a/cpukit/include/rtems/thread.hpp +++ b/cpukit/include/rtems/thread.hpp @@ -220,6 +220,12 @@ namespace rtems /* affinity, cpu set size is? */ }; + template + inline typename std::decay::type + decay_copy(T&& t) { + return std::forward(t); + } + /** * @brief Create a thread with thread attributes. * @@ -310,7 +316,14 @@ namespace rtems */ template > - explicit thread(A&& attr, F&& func, Args&&... args); + explicit thread(A&& attr, F&& func, Args&&... args) + : id_(0) { + start_thread( + make_state(attr, + make_invoker(decay_copy(std::forward(func)), + decay_copy(std::forward(args))...)) + ); + } /** * Move the thread id to this instance. @@ -428,12 +441,6 @@ namespace rtems void start_thread(state_ptr s); }; - template - inline typename std::decay::type - decay_copy(T&& t) { - return std::forward(t); - } - template thread::thread(F&& func, Args&&... args) : id_(0) { @@ -445,17 +452,6 @@ namespace rtems ); } - template> - thread::thread(A&& attr, F&& func, Args&&... args) - : id_(0) { - start_thread( - make_state(attr, - make_invoker(decay_copy(std::forward(func)), - decay_copy(std::forward(args))...)) - ); - } - inline std::thread::id thread::get_id() const noexcept { return std::thread::id(id_.id_); } -- cgit v1.2.3