platformSystem.h 715 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef __platformSystem__
  2. #define __platformSystem__
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <stdio.h>
  7. #include <stdint.h>
  8. #include <string.h>
  9. #include <assert.h>
  10. #include <pthread.h>
  11. #include <unistd.h>
  12. #include <stdlib.h>
  13. #include <time.h>
  14. #include "valloc.h"
  15. #define platformAssert(EX) assert(EX)
  16. #define RyanMqttMemset memset
  17. #define RyanMqttStrlen strlen
  18. #define RyanMqttMemcpy memcpy
  19. #define RyanMqttStrcmp strcmp
  20. typedef struct
  21. {
  22. pthread_t thread;
  23. pthread_mutex_t mutex;
  24. pthread_cond_t cond;
  25. } platformThread_t;
  26. typedef struct
  27. {
  28. pthread_mutex_t mutex;
  29. } platformMutex_t;
  30. typedef struct
  31. {
  32. pthread_spinlock_t spin;
  33. } platformCritical_t;
  34. #ifdef __cplusplus
  35. }
  36. #endif
  37. #endif