le_thread.h
Go to the documentation of this file.
66 * le_thread_Cancel() or <c>pthread_cancel()</c>), it will be blocked and remain in a pending state67 * until cancellation is unblocked (also using pthread_setcancelstate()), at which time the thread104 * lack of synchronization. If threads share data, they @b MUST be synchronized with each other to107 * @warning This documentation assumes that the reader is familiar with multi-thread synchronization148 * dies, then that thread must call le_thread_CleanupLegatoThreadData() before it exits. Otherwise173 //--------------------------------------------------------------------------------------------------179 //--------------------------------------------------------------------------------------------------183 //--------------------------------------------------------------------------------------------------188 * They are privileged levels and will therefore not be allowed unless the application is executed195 //--------------------------------------------------------------------------------------------------248 //--------------------------------------------------------------------------------------------------257 //--------------------------------------------------------------------------------------------------259 (265 //--------------------------------------------------------------------------------------------------276 //--------------------------------------------------------------------------------------------------285 //--------------------------------------------------------------------------------------------------289 //--------------------------------------------------------------------------------------------------292 //--------------------------------------------------------------------------------------------------303 //--------------------------------------------------------------------------------------------------316 //--------------------------------------------------------------------------------------------------324 //--------------------------------------------------------------------------------------------------332 //--------------------------------------------------------------------------------------------------349 //--------------------------------------------------------------------------------------------------358 //--------------------------------------------------------------------------------------------------365 //--------------------------------------------------------------------------------------------------372 //--------------------------------------------------------------------------------------------------384 //--------------------------------------------------------------------------------------------------389 //--------------------------------------------------------------------------------------------------393 * Setting the stack explicitly allows the caller to control the memory allocation of the thread's397 * The macro LE_THREAD_DEFINE_STATIC_STACK() may be used to create a statically allocated stack for400 * @attention In general, this function is only useful on embedded, RTOS based systems in order to409 //--------------------------------------------------------------------------------------------------420 //--------------------------------------------------------------------------------------------------426 //--------------------------------------------------------------------------------------------------433 //--------------------------------------------------------------------------------------------------438 //--------------------------------------------------------------------------------------------------445 //--------------------------------------------------------------------------------------------------466 //--------------------------------------------------------------------------------------------------476 //--------------------------------------------------------------------------------------------------480 //--------------------------------------------------------------------------------------------------489 //--------------------------------------------------------------------------------------------------501 //--------------------------------------------------------------------------------------------------508 //--------------------------------------------------------------------------------------------------516 * @note This function is not a full equivalence of nanosleep() as the remaining sleep time will not519 //--------------------------------------------------------------------------------------------------526 //--------------------------------------------------------------------------------------------------532 //--------------------------------------------------------------------------------------------------539 //--------------------------------------------------------------------------------------------------543 //--------------------------------------------------------------------------------------------------552 //--------------------------------------------------------------------------------------------------556 //--------------------------------------------------------------------------------------------------563 //--------------------------------------------------------------------------------------------------570 //--------------------------------------------------------------------------------------------------572 (578 //--------------------------------------------------------------------------------------------------582 //--------------------------------------------------------------------------------------------------586 //--------------------------------------------------------------------------------------------------597 //--------------------------------------------------------------------------------------------------605 //--------------------------------------------------------------------------------------------------614 * avoid a race condition that can cause resource leakage when a parent thread passes dynamically619 * For example, a thread @e T1 could allocate an object from a memory pool, create a thread @e T2,624 * released. So, we allow @e T1 to register a destructor function for @e T2 before starting @e T2.628 //--------------------------------------------------------------------------------------------------637 //--------------------------------------------------------------------------------------------------641 //--------------------------------------------------------------------------------------------------647 //--------------------------------------------------------------------------------------------------651 //--------------------------------------------------------------------------------------------------657 //--------------------------------------------------------------------------------------------------661 //--------------------------------------------------------------------------------------------------668 //--------------------------------------------------------------------------------------------------679 //--------------------------------------------------------------------------------------------------686 //--------------------------------------------------------------------------------------------------690 //--------------------------------------------------------------------------------------------------693 //--------------------------------------------------------------------------------------------------704 //--------------------------------------------------------------------------------------------------715 //--------------------------------------------------------------------------------------------------717 * Clean-up the thread-specific data that was initialized using le_thread_InitLegatoThreadData().724 //--------------------------------------------------------------------------------------------------LE_FULL_API le_result_t le_thread_Cancel(le_thread_Ref_t threadToCancel)Definition: le_cdata.h:57void le_thread_RemoveDestructor(le_thread_DestructorRef_t destructor)struct le_thread_Destructor * le_thread_DestructorRef_tDefinition: le_thread.h:583le_result_t le_thread_SetStackSize(le_thread_Ref_t thread, size_t size)le_result_t le_thread_SetPriority(le_thread_Ref_t thread, le_thread_Priority_t priority)void le_thread_GetName(le_thread_Ref_t threadRef, char *buffPtr, size_t buffSize)le_result_t le_thread_Join(le_thread_Ref_t thread, void **resultValuePtr)void le_thread_SetJoinable(le_thread_Ref_t thread)le_thread_Ref_t le_thread_GetCurrent(void)Medium, non-real-time priority level. THIS IS THE DEFAULT.Definition: le_thread.h:205void _le_thread_SetCDataInstancePtr(const _le_cdata_ThreadRec_t *cdataPtr)le_result_t le_thread_SetStack(le_thread_Ref_t thread, void *stack, size_t size)const _le_cdata_ThreadRec_t * _le_thread_GetCDataInstancePtr(void)void le_thread_CleanupLegatoThreadData(void)void le_thread_InitLegatoThreadData(const char *name)void le_thread_Exit(void *resultValue)le_thread_DestructorRef_t le_thread_AddDestructor(le_thread_Destructor_t destructor, void *context)void le_thread_AddChildDestructor(le_thread_Ref_t thread, le_thread_Destructor_t destructor, void *context)Definition: le_thread.h:200const char * le_thread_GetMyName(void)Lowest priority level. Only runs when nothing else to do.Definition: le_thread.h:198void le_thread_Start(le_thread_Ref_t thread)Definition: le_thread.h:208le_thread_Ref_t le_thread_Create(const char *name, le_thread_MainFunc_t mainFunc, void *context)int le_thread_Sleep(unsigned int seconds)