std_thread.h 944 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // std_thread.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__std_thread__
  9. #define __threadpp__std_thread__
  10. #include <thread>
  11. namespace threadpp
  12. {
  13. class std_thread
  14. {
  15. std::thread _thread;
  16. std_thread(){};
  17. void operator=(const std_thread& t){};
  18. std_thread(const std_thread& t){};
  19. public:
  20. typedef unsigned long long id_type;
  21. typedef void (*runnable)(void* ctx);
  22. static id_type null_id();
  23. std_thread(runnable r,void* t);
  24. ~std_thread();
  25. void join();
  26. void detach();
  27. bool is_equal(const std_thread& t) const;
  28. id_type get_id() const;
  29. static id_type current_thread_id();
  30. static void sleep(unsigned long millisecs);
  31. };
  32. }
  33. #include "std_thread.hpp"
  34. #endif /* defined(__threadpp__std_thread__) */