gl_pthread.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #ifndef __GSL_PTHREAD_H__
  2. #define __GSL_PTHREAD_H__
  3. #include "gl_types.h"
  4. /******************************************************************************/
  5. /*!
  6. * @brief Initialize data structures used in GSL Pthread APIs
  7. *
  8. * @param void
  9. *
  10. * @return @a GL_SUCCESS on success
  11. * @return @a GL_FAILURE on failure
  12. *******************************************************************************/
  13. GL_Status_t GL_PthreadInit(void);
  14. /******************************************************************************/
  15. /*!
  16. * @brief Create a posix thread refering to an attribute data structure
  17. *
  18. * @param pHandle Thread object identifier returned by the API (on success)
  19. * @param pAttr thread attribute
  20. * @param pEntryPoint Function address from which the task starts executing.
  21. * @param pTaskArg parameter passed to entry function.
  22. *
  23. * @return @a GL_SUCCESS on success
  24. * @return @a GL_FAILURE on failure
  25. *
  26. * @note Cannot be used from ISR/DSR.
  27. *******************************************************************************/
  28. GL_Status_t GL_PthreadCreate(GL_Pthread_t *pHandle, GL_PthreadAttr_t pAttr, void *(*pEntryPoint)(void *pArg), void *pTaskArg);
  29. /******************************************************************************/
  30. /*!
  31. * @brief Terminate current task.
  32. *
  33. * @param pRet a pointer pointed to a value return to any joined thread
  34. *
  35. * @return void
  36. *
  37. * @note Cannot be used from ISR/DSR.
  38. *******************************************************************************/
  39. void GL_PthreadExit(void *pRet);
  40. /******************************************************************************/
  41. /*!
  42. * @brief Initialize a posix thread attribute data structure
  43. *
  44. * @param pAttr posix thread attribute object identifier returned by the API
  45. *
  46. * @return @a GL_SUCCESS on success
  47. * @return @a GL_FAILURE on failure
  48. *
  49. * @note
  50. *******************************************************************************/
  51. GL_Status_t GL_PthreadAttrInit(GL_PthreadAttr_t *pAttr);
  52. /******************************************************************************/
  53. /*!
  54. * @brief Destroy a posix thread attribute data structure
  55. *
  56. * @param pAttr posix thread attribute object identifier returned by the API
  57. *
  58. * @return @a GL_SUCCESS on success
  59. * @return @a GL_FAILURE on failure
  60. *******************************************************************************/
  61. GL_Status_t GL_PthreadAttrDestroy(GL_PthreadAttr_t pAttr);
  62. /******************************************************************************/
  63. /*!
  64. * @brief Set inheritance attribute
  65. *
  66. * @param pAttr posix thread attribute object identifier returned by the API
  67. * @param inherit valid values are: GL_PTHREAD_INHERIT_SCHED, GL_PTHREAD_EXPLICIT_SCHED
  68. *
  69. * @return @a GL_SUCCESS on success
  70. * @return @a GL_FAILURE on failure
  71. *******************************************************************************/
  72. GL_Status_t GL_PthreadAttrSetinheritsched(GL_PthreadAttr_t pAttr, GL_UINT32 inherit);
  73. /******************************************************************************/
  74. /*!
  75. * @brief Get stack size form a posix thread attribute data structure
  76. *
  77. * @param pAttr posix thread attribute object identifier returned by the API
  78. * @param pSize a container to receive the stack size
  79. *
  80. * @return @a GL_SUCCESS on success
  81. * @return @a GL_FAILURE on failure
  82. *
  83. * @note
  84. *******************************************************************************/
  85. GL_Status_t GL_PthreadAttrGetStkSize(GL_PthreadAttr_t pAttr, GL_UINT32 *pSize);
  86. /******************************************************************************/
  87. /*!
  88. * @brief Set stack size into a posix thread attribute data structure
  89. *
  90. * @param pAttr posix thread attribute object identifier returned by the API
  91. * @param pSize a container to receive the stack size
  92. *
  93. * @return @a GL_SUCCESS on success
  94. * @return @a GL_FAILURE on failure
  95. *
  96. * @note
  97. *******************************************************************************/
  98. GL_Status_t GL_PthreadAttrSetStkSize(GL_PthreadAttr_t pAttr, GL_UINT32 dSize);
  99. #endif // __GSL_PTHREAD_H__