mirror of https://github.com/ARMmbed/mbed-os.git
rtos: NULL -> nullptr
Some build errors seen with NULL not being defined. Rather than add cstddef includes, switch to C++11 nullptr.pull/10104/head
parent
7442da30f9
commit
ed4bf5220e
|
@ -30,12 +30,12 @@
|
|||
|
||||
namespace rtos {
|
||||
|
||||
ConditionVariable::Waiter::Waiter(): sem(0), prev(NULL), next(NULL), in_list(false)
|
||||
ConditionVariable::Waiter::Waiter(): sem(0), prev(nullptr), next(nullptr), in_list(false)
|
||||
{
|
||||
// No initialization to do
|
||||
}
|
||||
|
||||
ConditionVariable::ConditionVariable(Mutex &mutex): _mutex(mutex), _wait_list(NULL)
|
||||
ConditionVariable::ConditionVariable(Mutex &mutex): _mutex(mutex), _wait_list(nullptr)
|
||||
{
|
||||
// No initialization to do
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ bool ConditionVariable::wait_until(uint64_t millisec)
|
|||
void ConditionVariable::notify_one()
|
||||
{
|
||||
MBED_ASSERT(_mutex.get_owner() == ThisThread::get_id());
|
||||
if (_wait_list != NULL) {
|
||||
if (_wait_list != nullptr) {
|
||||
_wait_list->sem.release();
|
||||
_remove_wait_list(&_wait_list, _wait_list);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ void ConditionVariable::notify_one()
|
|||
void ConditionVariable::notify_all()
|
||||
{
|
||||
MBED_ASSERT(_mutex.get_owner() == ThisThread::get_id());
|
||||
while (_wait_list != NULL) {
|
||||
while (_wait_list != nullptr) {
|
||||
_wait_list->sem.release();
|
||||
_remove_wait_list(&_wait_list, _wait_list);
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ void ConditionVariable::notify_all()
|
|||
|
||||
void ConditionVariable::_add_wait_list(Waiter **wait_list, Waiter *waiter)
|
||||
{
|
||||
if (NULL == *wait_list) {
|
||||
if (nullptr == *wait_list) {
|
||||
// Nothing in the list so add it directly.
|
||||
// Update prev and next pointer to reference self
|
||||
*wait_list = waiter;
|
||||
|
@ -137,18 +137,18 @@ void ConditionVariable::_remove_wait_list(Waiter **wait_list, Waiter *waiter)
|
|||
|
||||
if (*wait_list == waiter) {
|
||||
// This was the last element in the list
|
||||
*wait_list = NULL;
|
||||
*wait_list = nullptr;
|
||||
}
|
||||
|
||||
// Invalidate pointers
|
||||
waiter->next = NULL;
|
||||
waiter->prev = NULL;
|
||||
waiter->next = nullptr;
|
||||
waiter->prev = nullptr;
|
||||
waiter->in_list = false;
|
||||
}
|
||||
|
||||
ConditionVariable::~ConditionVariable()
|
||||
{
|
||||
MBED_ASSERT(NULL == _wait_list);
|
||||
MBED_ASSERT(nullptr == _wait_list);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ public:
|
|||
~EventFlags();
|
||||
|
||||
private:
|
||||
void constructor(const char *name = NULL);
|
||||
void constructor(const char *name = nullptr);
|
||||
uint32_t wait(uint32_t flags, uint32_t opt, uint32_t millisec, bool clear);
|
||||
#if MBED_CONF_RTOS_PRESENT
|
||||
osEventFlagsId_t _id;
|
||||
|
|
12
rtos/Mail.h
12
rtos/Mail.h
|
@ -97,7 +97,7 @@ public:
|
|||
*
|
||||
* @param millisec Not used (see note).
|
||||
*
|
||||
* @return Pointer to memory block that you can fill with mail or NULL in case error.
|
||||
* @return Pointer to memory block that you can fill with mail or nullptr in case error.
|
||||
*
|
||||
* @note You may call this function from ISR context.
|
||||
* @note If blocking is required, use Mail::alloc_for or Mail::alloc_until
|
||||
|
@ -111,7 +111,7 @@ public:
|
|||
*
|
||||
* @param millisec Timeout value, or osWaitForever.
|
||||
*
|
||||
* @return Pointer to memory block that you can fill with mail or NULL in case error.
|
||||
* @return Pointer to memory block that you can fill with mail or nullptr in case error.
|
||||
*
|
||||
* @note You may call this function from ISR context if the millisec parameter is set to 0.
|
||||
*/
|
||||
|
@ -124,7 +124,7 @@ public:
|
|||
*
|
||||
* @param millisec Absolute timeout time, referenced to Kernel::get_ms_count().
|
||||
*
|
||||
* @return Pointer to memory block that you can fill with mail or NULL in case error.
|
||||
* @return Pointer to memory block that you can fill with mail or nullptr in case error.
|
||||
*
|
||||
* @note You cannot call this function from ISR context.
|
||||
* @note the underlying RTOS may have a limit to the maximum wait time
|
||||
|
@ -141,7 +141,7 @@ public:
|
|||
*
|
||||
* @param millisec Not used (see note).
|
||||
*
|
||||
* @return Pointer to memory block that you can fill with mail or NULL in case error.
|
||||
* @return Pointer to memory block that you can fill with mail or nullptr in case error.
|
||||
*
|
||||
* @note You may call this function from ISR context if the millisec parameter is set to 0.
|
||||
* @note If blocking is required, use Mail::calloc_for or Mail::calloc_until
|
||||
|
@ -155,7 +155,7 @@ public:
|
|||
*
|
||||
* @param millisec Timeout value, or osWaitForever.
|
||||
*
|
||||
* @return Pointer to memory block that you can fill with mail or NULL in case error.
|
||||
* @return Pointer to memory block that you can fill with mail or nullptr in case error.
|
||||
*
|
||||
* @note You may call this function from ISR context if the millisec parameter is set to 0.
|
||||
*/
|
||||
|
@ -168,7 +168,7 @@ public:
|
|||
*
|
||||
* @param millisec Absolute timeout time, referenced to Kernel::get_ms_count().
|
||||
*
|
||||
* @return Pointer to memory block that you can fill with mail or NULL in case error.
|
||||
* @return Pointer to memory block that you can fill with mail or nullptr in case error.
|
||||
*
|
||||
* @note You cannot call this function from ISR context.
|
||||
* @note the underlying RTOS may have a limit to the maximum wait time
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
}
|
||||
|
||||
/** Allocate a memory block from a memory pool, without blocking.
|
||||
@return address of the allocated memory block or NULL in case of no memory available.
|
||||
@return address of the allocated memory block or nullptr in case of no memory available.
|
||||
|
||||
@note You may call this function from ISR context.
|
||||
*/
|
||||
|
@ -88,7 +88,7 @@ public:
|
|||
|
||||
/** Allocate a memory block from a memory pool, optionally blocking.
|
||||
@param millisec timeout value (osWaitForever to wait forever)
|
||||
@return address of the allocated memory block or NULL in case of no memory available.
|
||||
@return address of the allocated memory block or nullptr in case of no memory available.
|
||||
|
||||
@note You may call this function from ISR context if the millisec parameter is set to 0.
|
||||
*/
|
||||
|
@ -99,7 +99,7 @@ public:
|
|||
|
||||
/** Allocate a memory block from a memory pool, blocking.
|
||||
@param millisec absolute timeout time, referenced to Kernel::get_ms_count().
|
||||
@return address of the allocated memory block or NULL in case of no memory available.
|
||||
@return address of the allocated memory block or nullptr in case of no memory available.
|
||||
|
||||
@note You cannot call this function from ISR context.
|
||||
@note the underlying RTOS may have a limit to the maximum wait time
|
||||
|
@ -122,14 +122,14 @@ public:
|
|||
}
|
||||
|
||||
/** Allocate a memory block from a memory pool, without blocking, and set memory block to zero.
|
||||
@return address of the allocated memory block or NULL in case of no memory available.
|
||||
@return address of the allocated memory block or nullptr in case of no memory available.
|
||||
|
||||
@note You may call this function from ISR context.
|
||||
*/
|
||||
T *calloc(void)
|
||||
{
|
||||
T *item = alloc();
|
||||
if (item != NULL) {
|
||||
if (item != nullptr) {
|
||||
memset(item, 0, sizeof(T));
|
||||
}
|
||||
return item;
|
||||
|
@ -137,14 +137,14 @@ public:
|
|||
|
||||
/** Allocate a memory block from a memory pool, optionally blocking, and set memory block to zero.
|
||||
@param millisec timeout value (osWaitForever to wait forever)
|
||||
@return address of the allocated memory block or NULL in case of no memory available.
|
||||
@return address of the allocated memory block or nullptr in case of no memory available.
|
||||
|
||||
@note You may call this function from ISR context if the millisec parameter is set to 0.
|
||||
*/
|
||||
T *calloc_for(uint32_t millisec)
|
||||
{
|
||||
T *item = alloc_for(millisec);
|
||||
if (item != NULL) {
|
||||
if (item != nullptr) {
|
||||
memset(item, 0, sizeof(T));
|
||||
}
|
||||
return item;
|
||||
|
@ -152,7 +152,7 @@ public:
|
|||
|
||||
/** Allocate a memory block from a memory pool, blocking, and set memory block to zero.
|
||||
@param millisec absolute timeout time, referenced to Kernel::get_ms_count().
|
||||
@return address of the allocated memory block or NULL in case of no memory available.
|
||||
@return address of the allocated memory block or nullptr in case of no memory available.
|
||||
|
||||
@note You cannot call this function from ISR context.
|
||||
@note the underlying RTOS may have a limit to the maximum wait time
|
||||
|
@ -163,7 +163,7 @@ public:
|
|||
T *calloc_until(uint64_t millisec)
|
||||
{
|
||||
T *item = alloc_until(millisec);
|
||||
if (item != NULL) {
|
||||
if (item != nullptr) {
|
||||
memset(item, 0, sizeof(T));
|
||||
}
|
||||
return item;
|
||||
|
@ -172,7 +172,7 @@ public:
|
|||
/** Free a memory block.
|
||||
@param block address of the allocated memory block to be freed.
|
||||
@return osOK on successful deallocation, osErrorParameter if given memory block id
|
||||
is NULL or invalid, or osErrorResource if given memory block is in an
|
||||
is nullptr or invalid, or osErrorResource if given memory block is in an
|
||||
invalid memory pool state.
|
||||
|
||||
@note You may call this function from ISR context.
|
||||
|
|
|
@ -177,7 +177,7 @@ public:
|
|||
|
||||
private:
|
||||
#if MBED_CONF_RTOS_PRESENT
|
||||
void constructor(const char *name = NULL);
|
||||
void constructor(const char *name = nullptr);
|
||||
friend class ConditionVariable;
|
||||
|
||||
osMutexId_t _id;
|
||||
|
|
|
@ -187,8 +187,8 @@ public:
|
|||
osEvent get(uint32_t millisec = osWaitForever)
|
||||
{
|
||||
osEvent event;
|
||||
T *data = NULL;
|
||||
osStatus_t res = osMessageQueueGet(_id, &data, NULL, millisec);
|
||||
T *data = nullptr;
|
||||
osStatus_t res = osMessageQueueGet(_id, &data, nullptr, millisec);
|
||||
|
||||
switch (res) {
|
||||
case osOK:
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
/** Create timer.
|
||||
@param func function to be executed by this timer.
|
||||
@param type osTimerOnce for one-shot or osTimerPeriodic for periodic behavior. (default: osTimerPeriodic)
|
||||
@param argument argument to the timer call back function. (default: NULL)
|
||||
@param argument argument to the timer call back function. (default: nullptr)
|
||||
@deprecated Replaced with RtosTimer(Callback<void()>, os_timer_type)
|
||||
@deprecated
|
||||
The RtosTimer has been superseded by the EventQueue. See RtosTimer.h for more details
|
||||
|
@ -102,7 +102,7 @@ public:
|
|||
"Replaced with RtosTimer(Callback<void()>, os_timer_type)")
|
||||
MBED_DEPRECATED_SINCE("mbed-os-5.2",
|
||||
"The RtosTimer has been superseded by the EventQueue. See RtosTimer.h for more details")
|
||||
RtosTimer(void (*func)(void const *argument), os_timer_type type = osTimerPeriodic, void *argument = NULL)
|
||||
RtosTimer(void (*func)(void const *argument), os_timer_type type = osTimerPeriodic, void *argument = nullptr)
|
||||
{
|
||||
constructor(mbed::callback((void (*)(void *))func, argument), type);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ void Semaphore::constructor(int32_t count, uint16_t max_count)
|
|||
attr.cb_mem = &_obj_mem;
|
||||
attr.cb_size = sizeof(_obj_mem);
|
||||
_id = osSemaphoreNew(max_count, count, &attr);
|
||||
MBED_ASSERT(_id != NULL);
|
||||
MBED_ASSERT(_id != nullptr);
|
||||
#else
|
||||
_count = count;
|
||||
_max_count = max_count;
|
||||
|
|
|
@ -159,8 +159,8 @@ extern "C" {
|
|||
|
||||
void rtos_attach_idle_hook(void (*fptr)(void))
|
||||
{
|
||||
//Attach the specified idle hook, or the default idle hook in case of a NULL pointer
|
||||
if (fptr != NULL) {
|
||||
//Attach the specified idle hook, or the default idle hook in case of a null pointer
|
||||
if (fptr != nullptr) {
|
||||
idle_hook_fptr = fptr;
|
||||
} else {
|
||||
idle_hook_fptr = default_idle_hook;
|
||||
|
|
|
@ -242,12 +242,12 @@ const char *get_name()
|
|||
{
|
||||
#if MBED_CONF_RTOS_PRESENT
|
||||
osThreadId_t id = osThreadGetId();
|
||||
if (id == NULL) {
|
||||
return NULL;
|
||||
if (id == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return osThreadGetName(id);
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -169,13 +169,13 @@ void sleep_until(uint64_t millisec);
|
|||
void yield();
|
||||
|
||||
/** Get the thread id of the current running thread.
|
||||
@return thread ID for reference by other functions or NULL in case of error or in ISR context.
|
||||
@return thread ID for reference by other functions or nullptr in case of error or in ISR context.
|
||||
@note You may call this function from ISR context.
|
||||
*/
|
||||
osThreadId_t get_id();
|
||||
|
||||
/** Get the thread name of the current running thread.
|
||||
@return thread name pointer or NULL if thread has no name or in case of error.
|
||||
@return thread name pointer or nullptr if thread has no name or in case of error.
|
||||
@note You cannot call this function from ISR context.
|
||||
*/
|
||||
const char *get_name();
|
||||
|
|
|
@ -52,7 +52,7 @@ void Thread::constructor(uint32_t tz_module, osPriority priority,
|
|||
const uint32_t aligned_size = ALIGN_DOWN(stack_size - offset, 8);
|
||||
|
||||
_tid = 0;
|
||||
_dynamic_stack = (stack_mem == NULL);
|
||||
_dynamic_stack = (stack_mem == nullptr);
|
||||
_finished = false;
|
||||
memset(&_attr, 0, sizeof(_attr));
|
||||
_attr.priority = priority;
|
||||
|
@ -96,9 +96,9 @@ osStatus Thread::start(mbed::Callback<void()> task)
|
|||
return osErrorParameter;
|
||||
}
|
||||
|
||||
if (_attr.stack_mem == NULL) {
|
||||
if (_attr.stack_mem == nullptr) {
|
||||
_attr.stack_mem = new uint32_t[_attr.stack_size / sizeof(uint32_t)];
|
||||
MBED_ASSERT(_attr.stack_mem != NULL);
|
||||
MBED_ASSERT(_attr.stack_mem != nullptr);
|
||||
}
|
||||
|
||||
//Fill the stack with a magic word for maximum usage checking
|
||||
|
@ -111,10 +111,10 @@ osStatus Thread::start(mbed::Callback<void()> task)
|
|||
_attr.cb_mem = &_obj_mem;
|
||||
_task = task;
|
||||
_tid = osThreadNew(Thread::_thunk, this, &_attr);
|
||||
if (_tid == NULL) {
|
||||
if (_tid == nullptr) {
|
||||
if (_dynamic_stack) {
|
||||
delete[](uint32_t *)(_attr.stack_mem);
|
||||
_attr.stack_mem = (uint32_t *)NULL;
|
||||
delete[] _attr.stack_mem;
|
||||
_attr.stack_mem = nullptr;
|
||||
}
|
||||
_mutex.unlock();
|
||||
_join_sem.release();
|
||||
|
@ -130,12 +130,12 @@ osStatus Thread::terminate()
|
|||
osStatus_t ret = osOK;
|
||||
_mutex.lock();
|
||||
|
||||
// Set the Thread's tid to NULL and
|
||||
// Set the Thread's tid to nullptr and
|
||||
// release the semaphore before terminating
|
||||
// since this thread could be terminating itself
|
||||
osThreadId_t local_id = _tid;
|
||||
_join_sem.release();
|
||||
_tid = (osThreadId_t)NULL;
|
||||
_tid = nullptr;
|
||||
if (!_finished) {
|
||||
_finished = true;
|
||||
// if local_id == 0 Thread was not started in first place
|
||||
|
@ -156,7 +156,7 @@ osStatus Thread::join()
|
|||
// terminated or has been terminated. Once the mutex has
|
||||
// been locked it is ensured that the thread is deleted.
|
||||
_mutex.lock();
|
||||
MBED_ASSERT(NULL == _tid);
|
||||
MBED_ASSERT(nullptr == _tid);
|
||||
_mutex.unlock();
|
||||
|
||||
// Release sem so any other threads joining this thread wake up
|
||||
|
@ -204,7 +204,7 @@ Thread::State Thread::get_state() const
|
|||
|
||||
_mutex.lock();
|
||||
|
||||
if (_tid != NULL) {
|
||||
if (_tid != nullptr) {
|
||||
#if defined(MBED_OS_BACKEND_RTX5)
|
||||
state = _obj_mem.state;
|
||||
#else
|
||||
|
@ -269,7 +269,7 @@ uint32_t Thread::stack_size() const
|
|||
uint32_t size = 0;
|
||||
_mutex.lock();
|
||||
|
||||
if (_tid != NULL) {
|
||||
if (_tid != nullptr) {
|
||||
size = osThreadGetStackSize(_tid);
|
||||
}
|
||||
|
||||
|
@ -283,7 +283,7 @@ uint32_t Thread::free_stack() const
|
|||
_mutex.lock();
|
||||
|
||||
#if defined(MBED_OS_BACKEND_RTX5)
|
||||
if (_tid != NULL) {
|
||||
if (_tid != nullptr) {
|
||||
mbed_rtos_storage_thread_t *thread = (mbed_rtos_storage_thread_t *)_tid;
|
||||
size = (uint32_t)thread->sp - (uint32_t)thread->stack_mem;
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ uint32_t Thread::used_stack() const
|
|||
_mutex.lock();
|
||||
|
||||
#if defined(MBED_OS_BACKEND_RTX5)
|
||||
if (_tid != NULL) {
|
||||
if (_tid != nullptr) {
|
||||
mbed_rtos_storage_thread_t *thread = (mbed_rtos_storage_thread_t *)_tid;
|
||||
size = ((uint32_t)thread->stack_mem + thread->stack_size) - thread->sp;
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ uint32_t Thread::max_stack() const
|
|||
uint32_t size = 0;
|
||||
_mutex.lock();
|
||||
|
||||
if (_tid != NULL) {
|
||||
if (_tid != nullptr) {
|
||||
#if defined(MBED_OS_BACKEND_RTX5)
|
||||
mbed_rtos_storage_thread_t *thread = (mbed_rtos_storage_thread_t *)_tid;
|
||||
uint32_t high_mark = 0;
|
||||
|
@ -417,8 +417,8 @@ Thread::~Thread()
|
|||
// terminate is thread safe
|
||||
terminate();
|
||||
if (_dynamic_stack) {
|
||||
delete[](uint32_t *)(_attr.stack_mem);
|
||||
_attr.stack_mem = (uint32_t *)NULL;
|
||||
delete[] _attr.stack_mem;
|
||||
_attr.stack_mem = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -427,7 +427,7 @@ void Thread::_thunk(void *thread_ptr)
|
|||
Thread *t = (Thread *)thread_ptr;
|
||||
t->_task();
|
||||
t->_mutex.lock();
|
||||
t->_tid = (osThreadId)NULL;
|
||||
t->_tid = nullptr;
|
||||
t->_finished = true;
|
||||
t->_join_sem.release();
|
||||
// rtos will release the mutex automatically
|
||||
|
|
|
@ -89,8 +89,8 @@ public:
|
|||
/** Allocate a new thread without starting execution
|
||||
@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: NULL).
|
||||
@param name name to be used for this thread. It has to stay allocated for the lifetime of the thread (default: NULL)
|
||||
@param stack_mem pointer to the stack area to be used by this thread (default: nullptr).
|
||||
@param name name to be used for this thread. It has to stay allocated for the lifetime of the thread (default: nullptr)
|
||||
|
||||
@note Default value of tz_module will be MBED_TZ_DEFAULT_ACCESS
|
||||
@note You cannot call this function from ISR context.
|
||||
|
@ -98,7 +98,7 @@ public:
|
|||
|
||||
Thread(osPriority priority = osPriorityNormal,
|
||||
uint32_t stack_size = OS_STACK_SIZE,
|
||||
unsigned char *stack_mem = NULL, const char *name = NULL)
|
||||
unsigned char *stack_mem = nullptr, const char *name = nullptr)
|
||||
{
|
||||
constructor(priority, stack_size, stack_mem, name);
|
||||
}
|
||||
|
@ -110,15 +110,15 @@ public:
|
|||
threads not using secure calls at all. See "TrustZone RTOS Context Management" for more details.
|
||||
@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: NULL).
|
||||
@param name name to be used for this thread. It has to stay allocated for the lifetime of the thread (default: NULL)
|
||||
@param stack_mem pointer to the stack area to be used by this thread (default: nullptr).
|
||||
@param name name to be used for this thread. It has to stay allocated for the lifetime of the thread (default: nullptr)
|
||||
|
||||
@note You cannot call this function from ISR context.
|
||||
*/
|
||||
|
||||
Thread(uint32_t tz_module, osPriority priority = osPriorityNormal,
|
||||
uint32_t stack_size = OS_STACK_SIZE,
|
||||
unsigned char *stack_mem = NULL, const char *name = NULL)
|
||||
unsigned char *stack_mem = nullptr, const char *name = nullptr)
|
||||
{
|
||||
constructor(tz_module, priority, stack_size, stack_mem, name);
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ public:
|
|||
@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: NULL).
|
||||
@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).
|
||||
|
||||
|
@ -149,17 +149,17 @@ public:
|
|||
Thread(mbed::Callback<void()> task,
|
||||
osPriority priority = osPriorityNormal,
|
||||
uint32_t stack_size = OS_STACK_SIZE,
|
||||
unsigned char *stack_mem = NULL)
|
||||
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: NULL).
|
||||
@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: NULL).
|
||||
@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)).
|
||||
|
||||
|
@ -181,18 +181,18 @@ public:
|
|||
Thread(T *argument, void (T::*task)(),
|
||||
osPriority priority = osPriorityNormal,
|
||||
uint32_t stack_size = OS_STACK_SIZE,
|
||||
unsigned char *stack_mem = NULL)
|
||||
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: NULL).
|
||||
@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: NULL).
|
||||
@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)).
|
||||
|
||||
|
@ -214,7 +214,7 @@ public:
|
|||
Thread(T *argument, void (*task)(T *),
|
||||
osPriority priority = osPriorityNormal,
|
||||
uint32_t stack_size = OS_STACK_SIZE,
|
||||
unsigned char *stack_mem = NULL)
|
||||
unsigned char *stack_mem = nullptr)
|
||||
{
|
||||
constructor(mbed::callback(task, argument),
|
||||
priority, stack_size, stack_mem);
|
||||
|
@ -223,10 +223,10 @@ public:
|
|||
/** 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: NULL).
|
||||
@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: NULL).
|
||||
@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)).
|
||||
|
||||
|
@ -244,10 +244,10 @@ public:
|
|||
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 = NULL,
|
||||
Thread(void (*task)(void const *argument), void *argument = nullptr,
|
||||
osPriority priority = osPriorityNormal,
|
||||
uint32_t stack_size = OS_STACK_SIZE,
|
||||
unsigned char *stack_mem = NULL)
|
||||
unsigned char *stack_mem = nullptr)
|
||||
{
|
||||
constructor(mbed::callback((void (*)(void *))task, argument),
|
||||
priority, stack_size, stack_mem);
|
||||
|
@ -389,7 +389,7 @@ public:
|
|||
uint32_t max_stack() const;
|
||||
|
||||
/** Get thread name
|
||||
@return thread name or NULL if the name was not set.
|
||||
@return thread name or nullptr if the name was not set.
|
||||
|
||||
@note You may call this function from ISR context.
|
||||
*/
|
||||
|
@ -475,7 +475,7 @@ public:
|
|||
static osStatus yield();
|
||||
|
||||
/** Get the thread id of the current running thread.
|
||||
@return thread ID for reference by other functions or NULL in case of error.
|
||||
@return thread ID for reference by other functions or nullptr in case of error.
|
||||
|
||||
@note You may call this function from ISR context.
|
||||
@deprecated Static methods only affecting current thread cause confusion. Replaced by ThisThread::get_id.
|
||||
|
@ -519,18 +519,18 @@ private:
|
|||
// delegated constructors
|
||||
void constructor(osPriority priority = osPriorityNormal,
|
||||
uint32_t stack_size = OS_STACK_SIZE,
|
||||
unsigned char *stack_mem = NULL,
|
||||
const char *name = NULL);
|
||||
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 = NULL,
|
||||
const char *name = NULL);
|
||||
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,
|
||||
unsigned char *stack_mem = NULL,
|
||||
const char *name = NULL);
|
||||
unsigned char *stack_mem = nullptr,
|
||||
const char *name = nullptr);
|
||||
static void _thunk(void *thread_ptr);
|
||||
|
||||
mbed::Callback<void()> _task;
|
||||
|
|
Loading…
Reference in New Issue