platform_thread.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * @Author: jiejie
  3. * @Github: https://github.com/jiejieTop
  4. * @Date: 2019-12-15 18:31:44
  5. * @LastEditTime: 2020-10-17 14:15:21
  6. * @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
  7. */
  8. #ifndef _PLATFORM_THREAD_H_
  9. #define _PLATFORM_THREAD_H_
  10. #include <pthread.h>
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. typedef struct platform_thread {
  15. pthread_t thread;
  16. pthread_mutex_t mutex;
  17. pthread_cond_t cond;
  18. } platform_thread_t;
  19. platform_thread_t *platform_thread_init( const char *name,
  20. void (*entry)(void *),
  21. void * const param,
  22. unsigned int stack_size,
  23. unsigned int priority,
  24. unsigned int tick);
  25. void platform_thread_startup(platform_thread_t* thread);
  26. void platform_thread_stop(platform_thread_t* thread);
  27. void platform_thread_start(platform_thread_t* thread);
  28. void platform_thread_destroy(platform_thread_t* thread);
  29. #ifdef __cplusplus
  30. }
  31. #endif
  32. #endif