Skip to content

Commit d3f95d2

Browse files
authored
Merge pull request #2055 from geky/rtos-deprecate-threads
Marked thread-spawning constructors as deprecated
2 parents 3051436 + fab672a commit d3f95d2

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

rtos/rtos/Thread.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <stdint.h>
2626
#include "cmsis_os.h"
2727
#include "Callback.h"
28+
#include "toolchain.h"
2829

2930
namespace rtos {
3031

@@ -48,7 +49,16 @@ class Thread {
4849
@param priority initial priority of the thread function. (default: osPriorityNormal).
4950
@param stack_size stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE).
5051
@param stack_pointer pointer to the stack area to be used by this thread (default: NULL).
52+
@deprecated
53+
Thread-spawning constructors hide errors and may lead to complex
54+
program state when a thread is declared.
55+
56+
The explicit Thread::start member function should be used to spawn
57+
a thread.
5158
*/
59+
MBED_DEPRECATED(
60+
"Thread-spawning constructors hide errors and may lead to complex "
61+
"program state when a thread is declared")
5262
Thread(mbed::Callback<void()> task,
5363
osPriority priority=osPriorityNormal,
5464
uint32_t stack_size=DEFAULT_STACK_SIZE,
@@ -63,8 +73,17 @@ class Thread {
6373
@param priority initial priority of the thread function. (default: osPriorityNormal).
6474
@param stack_size stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE).
6575
@param stack_pointer pointer to the stack area to be used by this thread (default: NULL).
76+
@deprecated
77+
Thread-spawning constructors hide errors and may lead to complex
78+
program state when a thread is declared.
79+
80+
The explicit Thread::start member function should be used to spawn
81+
a thread.
6682
*/
6783
template <typename T>
84+
MBED_DEPRECATED(
85+
"Thread-spawning constructors hide errors and may lead to complex "
86+
"program state when a thread is declared")
6887
Thread(T *obj, void (T::*method)(),
6988
osPriority priority=osPriorityNormal,
7089
uint32_t stack_size=DEFAULT_STACK_SIZE,
@@ -80,8 +99,17 @@ class Thread {
8099
@param priority initial priority of the thread function. (default: osPriorityNormal).
81100
@param stack_size stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE).
82101
@param stack_pointer pointer to the stack area to be used by this thread (default: NULL).
102+
@deprecated
103+
Thread-spawning constructors hide errors and may lead to complex
104+
program state when a thread is declared.
105+
106+
The explicit Thread::start member function should be used to spawn
107+
a thread.
83108
*/
84109
template <typename T>
110+
MBED_DEPRECATED(
111+
"Thread-spawning constructors hide errors and may lead to complex "
112+
"program state when a thread is declared")
85113
Thread(T *obj, void (*method)(T *),
86114
osPriority priority=osPriorityNormal,
87115
uint32_t stack_size=DEFAULT_STACK_SIZE,
@@ -97,7 +125,16 @@ class Thread {
97125
@param priority initial priority of the thread function. (default: osPriorityNormal).
98126
@param stack_size stack size (in bytes) requirements for the thread function. (default: DEFAULT_STACK_SIZE).
99127
@param stack_pointer pointer to the stack area to be used by this thread (default: NULL).
128+
@deprecated
129+
Thread-spawning constructors hide errors and may lead to complex
130+
program state when a thread is declared.
131+
132+
The explicit Thread::start member function should be used to spawn
133+
a thread.
100134
*/
135+
MBED_DEPRECATED(
136+
"Thread-spawning constructors hide errors and may lead to complex "
137+
"program state when a thread is declared")
101138
Thread(void (*task)(void const *argument), void *argument=NULL,
102139
osPriority priority=osPriorityNormal,
103140
uint32_t stack_size=DEFAULT_STACK_SIZE,

0 commit comments

Comments
 (0)