From fab672a05e0978f08a25c4235eeadbfe27e71810 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Tue, 28 Jun 2016 14:33:22 -0500 Subject: [PATCH] Marked thread-spawning constructors as deprecated Thread-spawning constructors hide errors and may lead to complex program state when a thread is declared. The explicit Thread::start member function should be used to spawn a thread. --- rtos/rtos/Thread.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/rtos/rtos/Thread.h b/rtos/rtos/Thread.h index 93880117ff..35b60ba760 100644 --- a/rtos/rtos/Thread.h +++ b/rtos/rtos/Thread.h @@ -25,6 +25,7 @@ #include #include "cmsis_os.h" #include "Callback.h" +#include "toolchain.h" namespace rtos { @@ -48,7 +49,16 @@ public: @param priority initial priority of the thread function. (default: osPriorityNormal). @param stack_size stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE). @param stack_pointer pointer to the stack area to be used by this thread (default: NULL). + @deprecated + Thread-spawning constructors hide errors and may lead to complex + program state when a thread is declared. + + The explicit Thread::start member function should be used to spawn + a thread. */ + MBED_DEPRECATED( + "Thread-spawning constructors hide errors and may lead to complex " + "program state when a thread is declared") Thread(mbed::Callback task, osPriority priority=osPriorityNormal, uint32_t stack_size=DEFAULT_STACK_SIZE, @@ -63,8 +73,17 @@ public: @param priority initial priority of the thread function. (default: osPriorityNormal). @param stack_size stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE). @param stack_pointer pointer to the stack area to be used by this thread (default: NULL). + @deprecated + Thread-spawning constructors hide errors and may lead to complex + program state when a thread is declared. + + The explicit Thread::start member function should be used to spawn + a thread. */ template + MBED_DEPRECATED( + "Thread-spawning constructors hide errors and may lead to complex " + "program state when a thread is declared") Thread(T *obj, void (T::*method)(), osPriority priority=osPriorityNormal, uint32_t stack_size=DEFAULT_STACK_SIZE, @@ -80,8 +99,17 @@ public: @param priority initial priority of the thread function. (default: osPriorityNormal). @param stack_size stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE). @param stack_pointer pointer to the stack area to be used by this thread (default: NULL). + @deprecated + Thread-spawning constructors hide errors and may lead to complex + program state when a thread is declared. + + The explicit Thread::start member function should be used to spawn + a thread. */ template + MBED_DEPRECATED( + "Thread-spawning constructors hide errors and may lead to complex " + "program state when a thread is declared") Thread(T *obj, void (*method)(T *), osPriority priority=osPriorityNormal, uint32_t stack_size=DEFAULT_STACK_SIZE, @@ -97,7 +125,16 @@ public: @param priority initial priority of the thread function. (default: osPriorityNormal). @param stack_size stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE). @param stack_pointer pointer to the stack area to be used by this thread (default: NULL). + @deprecated + Thread-spawning constructors hide errors and may lead to complex + program state when a thread is declared. + + The explicit Thread::start member function should be used to spawn + a thread. */ + MBED_DEPRECATED( + "Thread-spawning constructors hide errors and may lead to complex " + "program state when a thread is declared") Thread(void (*task)(void const *argument), void *argument=NULL, osPriority priority=osPriorityNormal, uint32_t stack_size=DEFAULT_STACK_SIZE,