threadpp.h 937 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // threadpp.h
  3. // threadpp
  4. //
  5. // Created by Melo Yao on 1/15/15.
  6. // Copyright (c) 2015 Melo Yao. All rights reserved.
  7. //
  8. #ifndef threadpp_threadpp_h
  9. #define threadpp_threadpp_h
  10. #include "recursive_lock.h"
  11. #if __posix || __APPLE__ || __linux
  12. #include "impl/pthread_thread.h"
  13. #include "impl/pthread_lock.h"
  14. namespace threadpp
  15. {
  16. typedef pthread_thread thread;
  17. typedef pthread_lock lock;
  18. typedef recursive_lock<pthread_lock, pthread_thread> recursivelock;
  19. }
  20. #elif defined(WIN32)
  21. #include "impl/win_thread.h"
  22. #include "impl/win_lock.h"
  23. namespace threadpp
  24. {
  25. typedef win_thread thread;
  26. typedef win_lock lock;
  27. typedef recursive_lock<win_lock, win_thread> recursivelock;
  28. }
  29. #elif __cplusplus>=201103L
  30. #include "impl/std_thread.h"
  31. #include "impl/std_lock.h"
  32. namespace threadpp
  33. {
  34. typedef std_thread thread;
  35. typedef std_lock lock;
  36. typedef recursive_lock<std_lock, std_thread> recursivelock;
  37. }
  38. #endif
  39. #endif