platform_mutex.h 728 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * @Author: jiejie
  3. * @Github: https://github.com/jiejieTop
  4. * @Date: 2019-12-15 18:31:33
  5. * @LastEditTime: 2020-10-17 14:17:31
  6. * @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
  7. */
  8. #ifndef _PLATFORM_MUTEX_H_
  9. #define _PLATFORM_MUTEX_H_
  10. #include <pthread.h>
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. typedef struct platform_mutex {
  15. pthread_mutex_t mutex;
  16. } platform_mutex_t;
  17. int platform_mutex_init(platform_mutex_t* m);
  18. int platform_mutex_lock(platform_mutex_t* m);
  19. int platform_mutex_trylock(platform_mutex_t* m);
  20. int platform_mutex_unlock(platform_mutex_t* m);
  21. int platform_mutex_destroy(platform_mutex_t* m);
  22. #ifdef __cplusplus
  23. }
  24. #endif
  25. #endif