Skip to content

Commit 077c6aa

Browse files
committed
Thread: remove constructors deprecated in 5.1
1 parent 1d5bd75 commit 077c6aa

File tree

2 files changed

+0
-171
lines changed

2 files changed

+0
-171
lines changed

rtos/Thread.h

Lines changed: 0 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -125,135 +125,6 @@ class Thread : private mbed::NonCopyable<Thread> {
125125
}
126126

127127

128-
/** Create a new thread, and start it executing the specified function.
129-
@param task function to be executed by this thread.
130-
@param priority initial priority of the thread function. (default: osPriorityNormal).
131-
@param stack_size stack size (in bytes) requirements for the thread function. (default: OS_STACK_SIZE).
132-
@param stack_mem pointer to the stack area to be used by this thread (default: nullptr).
133-
@deprecated
134-
Thread-spawning constructors hide errors. Replaced by thread.start(task).
135-
136-
@code
137-
Thread thread(priority, stack_size, stack_mem);
138-
139-
osStatus status = thread.start(task);
140-
if (status != osOK) {
141-
error("oh no!");
142-
}
143-
@endcode
144-
145-
@note You cannot call this function from ISR context.
146-
*/
147-
MBED_DEPRECATED_SINCE("mbed-os-5.1",
148-
"Thread-spawning constructors hide errors. "
149-
"Replaced by thread.start(task).")
150-
Thread(mbed::Callback<void()> task,
151-
osPriority priority = osPriorityNormal,
152-
uint32_t stack_size = OS_STACK_SIZE,
153-
unsigned char *stack_mem = nullptr)
154-
{
155-
constructor(task, priority, stack_size, stack_mem);
156-
}
157-
158-
/** Create a new thread, and start it executing the specified function.
159-
@param argument pointer that is passed to the thread function as start argument. (default: nullptr).
160-
@param task argument to task.
161-
@param priority initial priority of the thread function. (default: osPriorityNormal).
162-
@param stack_size stack size (in bytes) requirements for the thread function. (default: OS_STACK_SIZE).
163-
@param stack_mem pointer to the stack area to be used by this thread (default: nullptr).
164-
@deprecated
165-
Thread-spawning constructors hide errors. Replaced by thread.start(callback(task, argument)).
166-
167-
@code
168-
Thread thread(priority, stack_size, stack_mem);
169-
170-
osStatus status = thread.start(callback(task, argument));
171-
if (status != osOK) {
172-
error("oh no!");
173-
}
174-
@endcode
175-
176-
@note You cannot call this function from ISR context.
177-
*/
178-
template <typename T>
179-
MBED_DEPRECATED_SINCE("mbed-os-5.1",
180-
"Thread-spawning constructors hide errors. "
181-
"Replaced by thread.start(callback(task, argument)).")
182-
Thread(T *argument, void (T::*task)(),
183-
osPriority priority = osPriorityNormal,
184-
uint32_t stack_size = OS_STACK_SIZE,
185-
unsigned char *stack_mem = nullptr)
186-
{
187-
constructor(mbed::callback(task, argument),
188-
priority, stack_size, stack_mem);
189-
}
190-
191-
/** Create a new thread, and start it executing the specified function.
192-
@param argument pointer that is passed to the thread function as start argument. (default: nullptr).
193-
@param task argument to task.
194-
@param priority initial priority of the thread function. (default: osPriorityNormal).
195-
@param stack_size stack size (in bytes) requirements for the thread function. (default: OS_STACK_SIZE).
196-
@param stack_mem pointer to the stack area to be used by this thread (default: nullptr).
197-
@deprecated
198-
Thread-spawning constructors hide errors. Replaced by thread.start(callback(task, argument)).
199-
200-
@code
201-
Thread thread(priority, stack_size, stack_mem);
202-
203-
osStatus status = thread.start(callback(task, argument));
204-
if (status != osOK) {
205-
error("oh no!");
206-
}
207-
@endcode
208-
209-
@note You cannot call this function from ISR context.
210-
*/
211-
template <typename T>
212-
MBED_DEPRECATED_SINCE("mbed-os-5.1",
213-
"Thread-spawning constructors hide errors. "
214-
"Replaced by thread.start(callback(task, argument)).")
215-
Thread(T *argument, void (*task)(T *),
216-
osPriority priority = osPriorityNormal,
217-
uint32_t stack_size = OS_STACK_SIZE,
218-
unsigned char *stack_mem = nullptr)
219-
{
220-
constructor(mbed::callback(task, argument),
221-
priority, stack_size, stack_mem);
222-
}
223-
224-
/** Create a new thread, and start it executing the specified function.
225-
Provided for backwards compatibility
226-
@param task function to be executed by this thread.
227-
@param argument pointer that is passed to the thread function as start argument. (default: nullptr).
228-
@param priority initial priority of the thread function. (default: osPriorityNormal).
229-
@param stack_size stack size (in bytes) requirements for the thread function. (default: OS_STACK_SIZE).
230-
@param stack_mem pointer to the stack area to be used by this thread (default: nullptr).
231-
@deprecated
232-
Thread-spawning constructors hide errors. Replaced by thread.start(callback(task, argument)).
233-
234-
@code
235-
Thread thread(priority, stack_size, stack_mem);
236-
237-
osStatus status = thread.start(callback(task, argument));
238-
if (status != osOK) {
239-
error("oh no!");
240-
}
241-
@endcode
242-
243-
@note You cannot call this function from ISR context.
244-
*/
245-
MBED_DEPRECATED_SINCE("mbed-os-5.1",
246-
"Thread-spawning constructors hide errors. "
247-
"Replaced by thread.start(callback(task, argument)).")
248-
Thread(void (*task)(void const *argument), void *argument = nullptr,
249-
osPriority priority = osPriorityNormal,
250-
uint32_t stack_size = OS_STACK_SIZE,
251-
unsigned char *stack_mem = nullptr)
252-
{
253-
constructor(mbed::callback((void (*)(void *))task, argument),
254-
priority, stack_size, stack_mem);
255-
}
256-
257128
/** Starts a thread executing the specified function.
258129
@param task function to be executed by this thread.
259130
@return status code that indicates the execution status of the function.
@@ -263,24 +134,6 @@ class Thread : private mbed::NonCopyable<Thread> {
263134
*/
264135
osStatus start(mbed::Callback<void()> task);
265136

266-
/** Starts a thread executing the specified function.
267-
@param obj argument to task
268-
@param method function to be executed by this thread.
269-
@return status code that indicates the execution status of the function.
270-
@deprecated
271-
The start function does not support cv-qualifiers. Replaced by start(callback(obj, method)).
272-
273-
@note You cannot call this function from ISR context.
274-
*/
275-
template <typename T, typename M>
276-
MBED_DEPRECATED_SINCE("mbed-os-5.1",
277-
"The start function does not support cv-qualifiers. "
278-
"Replaced by thread.start(callback(obj, method)).")
279-
osStatus start(T *obj, M method)
280-
{
281-
return start(mbed::callback(obj, method));
282-
}
283-
284137
/** Wait for thread to terminate
285138
@return status code that indicates the execution status of the function.
286139
@@ -522,11 +375,6 @@ class Thread : private mbed::NonCopyable<Thread> {
522375
uint32_t stack_size = OS_STACK_SIZE,
523376
unsigned char *stack_mem = nullptr,
524377
const char *name = nullptr);
525-
void constructor(mbed::Callback<void()> task,
526-
osPriority priority = osPriorityNormal,
527-
uint32_t stack_size = OS_STACK_SIZE,
528-
unsigned char *stack_mem = nullptr,
529-
const char *name = nullptr);
530378
void constructor(uint32_t tz_module,
531379
osPriority priority = osPriorityNormal,
532380
uint32_t stack_size = OS_STACK_SIZE,

rtos/source/Thread.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -69,25 +69,6 @@ void Thread::constructor(osPriority priority,
6969
constructor(MBED_TZ_DEFAULT_ACCESS, priority, stack_size, stack_mem, name);
7070
}
7171

72-
void Thread::constructor(mbed::Callback<void()> task,
73-
osPriority priority, uint32_t stack_size, unsigned char *stack_mem, const char *name)
74-
{
75-
constructor(MBED_TZ_DEFAULT_ACCESS, priority, stack_size, stack_mem, name);
76-
77-
switch (start(task)) {
78-
case osErrorResource:
79-
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_OUT_OF_RESOURCES), "OS ran out of threads!\n", task);
80-
break;
81-
case osErrorParameter:
82-
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_ALREADY_IN_USE), "Thread already running!\n", task);
83-
break;
84-
case osErrorNoMemory:
85-
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_OUT_OF_MEMORY), "Error allocating the stack memory\n", task);
86-
default:
87-
break;
88-
}
89-
}
90-
9172
osStatus Thread::start(mbed::Callback<void()> task)
9273
{
9374
_mutex.lock();

0 commit comments

Comments
 (0)