std_lock.h 727 B

123456789101112131415161718192021222324252627282930313233
  1. //
  2. // std_lock.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_lock__
  9. #define __threadpp__std_lock__
  10. #include <mutex>
  11. #include <condition_variable>
  12. namespace threadpp
  13. {
  14. class std_lock
  15. {
  16. std::mutex _mutex;
  17. std::condition_variable_any _cond;
  18. void operator=(const std_lock& l){};
  19. std_lock(const std_lock& l){};
  20. public:
  21. std_lock();
  22. ~std_lock();
  23. void lock();
  24. void unlock();
  25. void wait();
  26. void wait(unsigned long millisecs);
  27. void notify();
  28. void notify_all();
  29. };
  30. }
  31. #include "std_lock.hpp"
  32. #endif /* defined(__threadpp__std_lock__) */