/// Terminate execution of a thread and remove it from Active Threads. /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId. /// \return status code that indicates the execution status of the function. /// \note MUST REMAIN UNCHANGED: \b osThreadTerminate shall be consistent in every CMSIS-RTOS. osStatus osThreadTerminate(osThreadId thread_id) { Win32Thread* thread = (Win32Thread*)thread_id; thread->terminate(); return osOK; }
unsigned int __stdcall Win32Thread::threadFunc(void *args) { Win32Thread *pThread = reinterpret_cast<Win32Thread*>(args); if (pThread) pThread->run(); _endthreadex(0); return 0; }
unsigned int __stdcall Win32Thread::_entry_point(void * argument) { Win32Thread * thread = reinterpret_cast<Win32Thread *>(argument); //YETI_LOG_FINER("thread in =============="); TimeStamp now; System::get_current_timestamp(now); System::set_random_integer((YETI_UInt32)(now.to_nanos() + ::GetCurrentThreadId())); thread->run(); if (thread->m_detached_) { delete thread->m_delegator_; } return 0; }
/// Get Signal Flags status of an active thread. /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId. /// \return previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters. /// \note MUST REMAIN UNCHANGED: \b osSignalGet shall be consistent in every CMSIS-RTOS. int32_t osSignalGet(osThreadId thread_id) { Win32Thread* thread = (Win32Thread*)thread_id; return thread->signal_get(); }
/// Clear the specified Signal Flags of an active thread. /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId. /// \param[in] signals specifies the signal flags of the thread that shall be cleared. /// \return previous signal flags of the specified thread or 0x80000000 in case of incorrect parameters. /// \note MUST REMAIN UNCHANGED: \b osSignalClear shall be consistent in every CMSIS-RTOS. int32_t osSignalClear(osThreadId thread_id, int32_t signals) { Win32Thread* thread = (Win32Thread*)thread_id; return thread->signal_clear(signals); }
int32_t osSignalSet(osThreadId thread_id, int32_t signals) { Win32Thread* thread = (Win32Thread*)thread_id; return thread->signal_set(signals); }
/// Get current priority of an active thread. /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId. /// \return current priority value of the thread function. /// \note MUST REMAIN UNCHANGED: \b osThreadGetPriority shall be consistent in every CMSIS-RTOS. osPriority osThreadGetPriority(osThreadId thread_id) { Win32Thread* thread = (Win32Thread*)thread_id; return thread->get_priority(); }
/// Change priority of an active thread. /// \param[in] thread_id thread ID obtained by \ref osThreadCreate or \ref osThreadGetId. /// \param[in] priority new priority value for the thread function. /// \return status code that indicates the execution status of the function. /// \note MUST REMAIN UNCHANGED: \b osThreadSetPriority shall be consistent in every CMSIS-RTOS. osStatus osThreadSetPriority(osThreadId thread_id, osPriority priority) { Win32Thread* thread = (Win32Thread*)thread_id; thread->set_priority(priority); return osOK; }