platform_mutex.c 777 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * @Author: jiejie
  3. * @Github: https://github.com/jiejieTop
  4. * @Date: 2019-12-15 18:27:19
  5. * @LastEditTime: 2020-02-23 15:01:06
  6. * @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
  7. */
  8. #include "platform_mutex.h"
  9. int platform_mutex_init(platform_mutex_t* m)
  10. {
  11. return pthread_mutex_init(&(m->mutex), NULL);
  12. }
  13. int platform_mutex_lock(platform_mutex_t* m)
  14. {
  15. return pthread_mutex_lock(&(m->mutex));
  16. }
  17. int platform_mutex_trylock(platform_mutex_t* m)
  18. {
  19. return pthread_mutex_trylock(&(m->mutex));
  20. }
  21. int platform_mutex_unlock(platform_mutex_t* m)
  22. {
  23. return pthread_mutex_unlock(&(m->mutex));
  24. }
  25. int platform_mutex_destroy(platform_mutex_t* m)
  26. {
  27. return pthread_mutex_destroy(&(m->mutex));
  28. }