Thread: remove constructors deprecated in 5.1

pull/12141/head
Kevin Bracey 2019-12-19 14:27:37 +02:00
parent 1d5bd750b9
commit 077c6aa78d
2 changed files with 0 additions and 171 deletions

View File

@ -125,135 +125,6 @@ public:
}
/** Create a new thread, and start it executing the specified function.
@param task function to be executed by this thread.
@param priority initial priority of the thread function. (default: osPriorityNormal).
@param stack_size stack size (in bytes) requirements for the thread function. (default: OS_STACK_SIZE).
@param stack_mem pointer to the stack area to be used by this thread (default: nullptr).
@deprecated
Thread-spawning constructors hide errors. Replaced by thread.start(task).
@code
Thread thread(priority, stack_size, stack_mem);
osStatus status = thread.start(task);
if (status != osOK) {
error("oh no!");
}
@endcode
@note You cannot call this function from ISR context.
*/
MBED_DEPRECATED_SINCE("mbed-os-5.1",
"Thread-spawning constructors hide errors. "
"Replaced by thread.start(task).")
Thread(mbed::Callback<void()> task,
osPriority priority = osPriorityNormal,
uint32_t stack_size = OS_STACK_SIZE,
unsigned char *stack_mem = nullptr)
{
constructor(task, priority, stack_size, stack_mem);
}
/** Create a new thread, and start it executing the specified function.
@param argument pointer that is passed to the thread function as start argument. (default: nullptr).
@param task argument to task.
@param priority initial priority of the thread function. (default: osPriorityNormal).
@param stack_size stack size (in bytes) requirements for the thread function. (default: OS_STACK_SIZE).
@param stack_mem pointer to the stack area to be used by this thread (default: nullptr).
@deprecated
Thread-spawning constructors hide errors. Replaced by thread.start(callback(task, argument)).
@code
Thread thread(priority, stack_size, stack_mem);
osStatus status = thread.start(callback(task, argument));
if (status != osOK) {
error("oh no!");
}
@endcode
@note You cannot call this function from ISR context.
*/
template <typename T>
MBED_DEPRECATED_SINCE("mbed-os-5.1",
"Thread-spawning constructors hide errors. "
"Replaced by thread.start(callback(task, argument)).")
Thread(T *argument, void (T::*task)(),
osPriority priority = osPriorityNormal,
uint32_t stack_size = OS_STACK_SIZE,
unsigned char *stack_mem = nullptr)
{
constructor(mbed::callback(task, argument),
priority, stack_size, stack_mem);
}
/** Create a new thread, and start it executing the specified function.
@param argument pointer that is passed to the thread function as start argument. (default: nullptr).
@param task argument to task.
@param priority initial priority of the thread function. (default: osPriorityNormal).
@param stack_size stack size (in bytes) requirements for the thread function. (default: OS_STACK_SIZE).
@param stack_mem pointer to the stack area to be used by this thread (default: nullptr).
@deprecated
Thread-spawning constructors hide errors. Replaced by thread.start(callback(task, argument)).
@code
Thread thread(priority, stack_size, stack_mem);
osStatus status = thread.start(callback(task, argument));
if (status != osOK) {
error("oh no!");
}
@endcode
@note You cannot call this function from ISR context.
*/
template <typename T>
MBED_DEPRECATED_SINCE("mbed-os-5.1",
"Thread-spawning constructors hide errors. "
"Replaced by thread.start(callback(task, argument)).")
Thread(T *argument, void (*task)(T *),
osPriority priority = osPriorityNormal,
uint32_t stack_size = OS_STACK_SIZE,
unsigned char *stack_mem = nullptr)
{
constructor(mbed::callback(task, argument),
priority, stack_size, stack_mem);
}
/** Create a new thread, and start it executing the specified function.
Provided for backwards compatibility
@param task function to be executed by this thread.
@param argument pointer that is passed to the thread function as start argument. (default: nullptr).
@param priority initial priority of the thread function. (default: osPriorityNormal).
@param stack_size stack size (in bytes) requirements for the thread function. (default: OS_STACK_SIZE).
@param stack_mem pointer to the stack area to be used by this thread (default: nullptr).
@deprecated
Thread-spawning constructors hide errors. Replaced by thread.start(callback(task, argument)).
@code
Thread thread(priority, stack_size, stack_mem);
osStatus status = thread.start(callback(task, argument));
if (status != osOK) {
error("oh no!");
}
@endcode
@note You cannot call this function from ISR context.
*/
MBED_DEPRECATED_SINCE("mbed-os-5.1",
"Thread-spawning constructors hide errors. "
"Replaced by thread.start(callback(task, argument)).")
Thread(void (*task)(void const *argument), void *argument = nullptr,
osPriority priority = osPriorityNormal,
uint32_t stack_size = OS_STACK_SIZE,
unsigned char *stack_mem = nullptr)
{
constructor(mbed::callback((void (*)(void *))task, argument),
priority, stack_size, stack_mem);
}
/** Starts a thread executing the specified function.
@param task function to be executed by this thread.
@return status code that indicates the execution status of the function.
@ -263,24 +134,6 @@ public:
*/
osStatus start(mbed::Callback<void()> task);
/** Starts a thread executing the specified function.
@param obj argument to task
@param method function to be executed by this thread.
@return status code that indicates the execution status of the function.
@deprecated
The start function does not support cv-qualifiers. Replaced by start(callback(obj, method)).
@note You cannot call this function from ISR context.
*/
template <typename T, typename M>
MBED_DEPRECATED_SINCE("mbed-os-5.1",
"The start function does not support cv-qualifiers. "
"Replaced by thread.start(callback(obj, method)).")
osStatus start(T *obj, M method)
{
return start(mbed::callback(obj, method));
}
/** Wait for thread to terminate
@return status code that indicates the execution status of the function.
@ -522,11 +375,6 @@ private:
uint32_t stack_size = OS_STACK_SIZE,
unsigned char *stack_mem = nullptr,
const char *name = nullptr);
void constructor(mbed::Callback<void()> task,
osPriority priority = osPriorityNormal,
uint32_t stack_size = OS_STACK_SIZE,
unsigned char *stack_mem = nullptr,
const char *name = nullptr);
void constructor(uint32_t tz_module,
osPriority priority = osPriorityNormal,
uint32_t stack_size = OS_STACK_SIZE,

View File

@ -69,25 +69,6 @@ void Thread::constructor(osPriority priority,
constructor(MBED_TZ_DEFAULT_ACCESS, priority, stack_size, stack_mem, name);
}
void Thread::constructor(mbed::Callback<void()> task,
osPriority priority, uint32_t stack_size, unsigned char *stack_mem, const char *name)
{
constructor(MBED_TZ_DEFAULT_ACCESS, priority, stack_size, stack_mem, name);
switch (start(task)) {
case osErrorResource:
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_OUT_OF_RESOURCES), "OS ran out of threads!\n", task);
break;
case osErrorParameter:
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_ALREADY_IN_USE), "Thread already running!\n", task);
break;
case osErrorNoMemory:
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_OUT_OF_MEMORY), "Error allocating the stack memory\n", task);
default:
break;
}
}
osStatus Thread::start(mbed::Callback<void()> task)
{
_mutex.lock();