gilstate.h 712 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright (C) 2016 The Qt Company Ltd.
  2. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
  3. #ifndef GILSTATE_H
  4. #define GILSTATE_H
  5. #include <shibokenmacros.h>
  6. #include "sbkpython.h"
  7. namespace Shiboken
  8. {
  9. class LIBSHIBOKEN_API GilState
  10. {
  11. public:
  12. GilState(const GilState &) = delete;
  13. GilState(GilState &&) = delete;
  14. GilState &operator=(const GilState &) = delete;
  15. GilState &operator=(GilState &&) = delete;
  16. explicit GilState(bool acquire=true);
  17. ~GilState();
  18. void acquire();
  19. void release();
  20. void abandon();
  21. private:
  22. PyGILState_STATE m_gstate;
  23. bool m_locked = false;
  24. };
  25. } // namespace Shiboken
  26. #endif // GILSTATE_H