summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/thread.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--cpukit/include/rtems/thread.h52
-rw-r--r--cpukit/include/rtems/thread.hpp32
2 files changed, 57 insertions, 27 deletions
diff --git a/cpukit/include/rtems/thread.h b/cpukit/include/rtems/thread.h
index 4988b46faa..c3d7de67f4 100644
--- a/cpukit/include/rtems/thread.h
+++ b/cpukit/include/rtems/thread.h
@@ -1,15 +1,37 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSAPISelfContainedObjects
+ *
+ * @brief This header file provides the API of
+ * @ref RTEMSAPISelfContainedObjects.
+ */
+
/*
- * Copyright (c) 2017 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2017 embedded brains GmbH & Co. KG
*
- * embedded brains GmbH
- * Dornierstr. 4
- * 82178 Puchheim
- * Germany
- * <rtems@embedded-brains.de>
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _RTEMS_THREAD_H
@@ -32,6 +54,16 @@ void _Semaphore_Post_binary(struct _Semaphore_Control *);
typedef struct _Mutex_Control rtems_mutex;
+/**
+ * @defgroup RTEMSAPISelfContainedObjects Self-Contained Objects
+ *
+ * @ingroup RTEMSAPI
+ *
+ * @brief This group contains the self-contained objects API.
+ *
+ * @{
+ */
+
#define RTEMS_MUTEX_INITIALIZER( name ) _MUTEX_NAMED_INITIALIZER( name )
static __inline void rtems_mutex_init( rtems_mutex *mutex, const char *name )
@@ -296,6 +328,8 @@ static __inline void rtems_binary_semaphore_destroy(
_Semaphore_Destroy( &binary_semaphore->Semaphore );
}
+/** @} */
+
__END_DECLS
#endif /* _RTEMS_THREAD_H */
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 <class T>
+ inline typename std::decay<T>::type
+ decay_copy(T&& t) {
+ return std::forward<T>(t);
+ }
+
/**
* @brief Create a thread with thread attributes.
*
@@ -310,7 +316,14 @@ namespace rtems
*/
template <typename A, typename F, typename ...Args,
class = enable_if_attributes<A>>
- 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<F>(func)),
+ decay_copy(std::forward<Args>(args))...))
+ );
+ }
/**
* Move the thread id to this instance.
@@ -428,12 +441,6 @@ namespace rtems
void start_thread(state_ptr s);
};
- template <class T>
- inline typename std::decay<T>::type
- decay_copy(T&& t) {
- return std::forward<T>(t);
- }
-
template<typename F, typename... Args>
thread::thread(F&& func, Args&&... args)
: id_(0) {
@@ -445,17 +452,6 @@ namespace rtems
);
}
- template<typename A, typename F, typename... Args,
- class = thread::enable_if_attributes<A>>
- thread::thread(A&& attr, F&& func, Args&&... args)
- : id_(0) {
- start_thread(
- make_state(attr,
- make_invoker(decay_copy(std::forward<F>(func)),
- decay_copy(std::forward<Args>(args))...))
- );
- }
-
inline std::thread::id thread::get_id() const noexcept {
return std::thread::id(id_.id_);
}