platform.h 805 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef _PLATFORM_H_
  2. #define _PLATFORM_H_
  3. #include <netinet/in.h>
  4. #include <sys/socket.h>
  5. #include <pthread.h>
  6. #include <fcntl.h>
  7. #include <errno.h>
  8. //#include <android/log.h>
  9. #include <arpa/inet.h>
  10. #include <unistd.h>
  11. #include <semaphore.h>
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #ifndef DELETE_POINTER
  16. #define DELETE_POINTER(p) \
  17. do\
  18. {\
  19. if (nullptr != p)\
  20. {\
  21. delete p;\
  22. p = nullptr;\
  23. }\
  24. } while (0)
  25. #endif
  26. #ifndef DELETE_POINTER_ARRAY
  27. #define DELETE_POINTER_ARRAY(p) \
  28. do\
  29. {\
  30. if (nullptr != p)\
  31. {\
  32. delete[] p;\
  33. p = nullptr;\
  34. }\
  35. } while (0)
  36. #endif
  37. #define sleep_ms(x) usleep(x * 1000)
  38. #define sleep_s(s) sleep(s)
  39. #define sleep_us(us) usleep(us)
  40. #define NetworkInit()
  41. #define NetworkCleanUp();
  42. #ifdef __cplusplus
  43. }
  44. #endif
  45. #endif/*#ifndef _PLATFORM_H_*/