aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/libshiboken/threadstatesaver.h
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/libshiboken/threadstatesaver.h')
-rw-r--r--sources/shiboken6/libshiboken/threadstatesaver.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/sources/shiboken6/libshiboken/threadstatesaver.h b/sources/shiboken6/libshiboken/threadstatesaver.h
new file mode 100644
index 000000000..4289f6726
--- /dev/null
+++ b/sources/shiboken6/libshiboken/threadstatesaver.h
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef THREADSTATESAVER_H
+#define THREADSTATESAVER_H
+
+#include "sbkpython.h"
+#include <shibokenmacros.h>
+
+namespace Shiboken
+{
+
+class LIBSHIBOKEN_API ThreadStateSaver
+{
+public:
+ ThreadStateSaver(const ThreadStateSaver &) = delete;
+ ThreadStateSaver(ThreadStateSaver &&) = delete;
+ ThreadStateSaver &operator=(const ThreadStateSaver &) = delete;
+ ThreadStateSaver &operator=(ThreadStateSaver &&) = delete;
+
+ ThreadStateSaver();
+ ~ThreadStateSaver();
+ void save();
+ void restore();
+private:
+ PyThreadState *m_threadState = nullptr;
+};
+
+} // namespace Shiboken
+
+#endif // THREADSTATESAVER_H
+