greenlet_thread_support.hpp 867 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef GREENLET_THREAD_SUPPORT_HPP
  2. #define GREENLET_THREAD_SUPPORT_HPP
  3. /**
  4. * Defines various utility functions to help greenlet integrate well
  5. * with threads. This used to be needed when we supported Python
  6. * 2.7 on Windows, which used a very old compiler. We wrote an
  7. * alternative implementation using Python APIs and POSIX or Windows
  8. * APIs, but that's no longer needed. So this file is a shadow of its
  9. * former self --- but may be needed in the future.
  10. */
  11. #include <stdexcept>
  12. #include <thread>
  13. #include <mutex>
  14. #include "greenlet_compiler_compat.hpp"
  15. namespace greenlet {
  16. typedef std::mutex Mutex;
  17. typedef std::lock_guard<Mutex> LockGuard;
  18. class LockInitError : public std::runtime_error
  19. {
  20. public:
  21. LockInitError(const char* what) : std::runtime_error(what)
  22. {};
  23. };
  24. };
  25. #endif /* GREENLET_THREAD_SUPPORT_HPP */