#ifndef __GSL_PTHREAD_H__ #define __GSL_PTHREAD_H__ #include "gl_types.h" /******************************************************************************/ /*! * @brief Initialize data structures used in GSL Pthread APIs * * @param void * * @return @a GL_SUCCESS on success * @return @a GL_FAILURE on failure *******************************************************************************/ GL_Status_t GL_PthreadInit(void); /******************************************************************************/ /*! * @brief Create a posix thread refering to an attribute data structure * * @param pHandle Thread object identifier returned by the API (on success) * @param pAttr thread attribute * @param pEntryPoint Function address from which the task starts executing. * @param pTaskArg parameter passed to entry function. * * @return @a GL_SUCCESS on success * @return @a GL_FAILURE on failure * * @note Cannot be used from ISR/DSR. *******************************************************************************/ GL_Status_t GL_PthreadCreate(GL_Pthread_t *pHandle, GL_PthreadAttr_t pAttr, void *(*pEntryPoint)(void *pArg), void *pTaskArg); /******************************************************************************/ /*! * @brief Terminate current task. * * @param pRet a pointer pointed to a value return to any joined thread * * @return void * * @note Cannot be used from ISR/DSR. *******************************************************************************/ void GL_PthreadExit(void *pRet); /******************************************************************************/ /*! * @brief Initialize a posix thread attribute data structure * * @param pAttr posix thread attribute object identifier returned by the API * * @return @a GL_SUCCESS on success * @return @a GL_FAILURE on failure * * @note *******************************************************************************/ GL_Status_t GL_PthreadAttrInit(GL_PthreadAttr_t *pAttr); /******************************************************************************/ /*! * @brief Destroy a posix thread attribute data structure * * @param pAttr posix thread attribute object identifier returned by the API * * @return @a GL_SUCCESS on success * @return @a GL_FAILURE on failure *******************************************************************************/ GL_Status_t GL_PthreadAttrDestroy(GL_PthreadAttr_t pAttr); /******************************************************************************/ /*! * @brief Set inheritance attribute * * @param pAttr posix thread attribute object identifier returned by the API * @param inherit valid values are: GL_PTHREAD_INHERIT_SCHED, GL_PTHREAD_EXPLICIT_SCHED * * @return @a GL_SUCCESS on success * @return @a GL_FAILURE on failure *******************************************************************************/ GL_Status_t GL_PthreadAttrSetinheritsched(GL_PthreadAttr_t pAttr, GL_UINT32 inherit); /******************************************************************************/ /*! * @brief Get stack size form a posix thread attribute data structure * * @param pAttr posix thread attribute object identifier returned by the API * @param pSize a container to receive the stack size * * @return @a GL_SUCCESS on success * @return @a GL_FAILURE on failure * * @note *******************************************************************************/ GL_Status_t GL_PthreadAttrGetStkSize(GL_PthreadAttr_t pAttr, GL_UINT32 *pSize); /******************************************************************************/ /*! * @brief Set stack size into a posix thread attribute data structure * * @param pAttr posix thread attribute object identifier returned by the API * @param pSize a container to receive the stack size * * @return @a GL_SUCCESS on success * @return @a GL_FAILURE on failure * * @note *******************************************************************************/ GL_Status_t GL_PthreadAttrSetStkSize(GL_PthreadAttr_t pAttr, GL_UINT32 dSize); #endif // __GSL_PTHREAD_H__