platformSystem.h 927 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. #ifdef RyanMqttLinuxTestEnable
  15. #include "valloc.h"
  16. #define malloc v_malloc
  17. #define calloc v_calloc
  18. #define free v_free
  19. #define realloc v_realloc
  20. #endif
  21. #define platformAssert(EX) assert(EX)
  22. #define RyanMqttMemset memset
  23. #define RyanMqttStrlen strlen
  24. #define RyanMqttMemcpy memcpy
  25. #define RyanMqttStrncmp strncmp
  26. #define RyanMqttSnprintf snprintf
  27. #define RyanMqttVsnprintf vsnprintf
  28. typedef struct
  29. {
  30. pthread_t thread;
  31. pthread_mutex_t mutex;
  32. pthread_cond_t cond;
  33. } platformThread_t;
  34. typedef struct
  35. {
  36. pthread_mutex_t mutex;
  37. } platformMutex_t;
  38. typedef struct
  39. {
  40. pthread_spinlock_t spin;
  41. } platformCritical_t;
  42. #ifdef __cplusplus
  43. }
  44. #endif
  45. #endif