rogue
Loading...
Searching...
No Matches
GilRelease.cpp
Go to the documentation of this file.
1
17#include "rogue/Directives.h"
18
19#include "rogue/GilRelease.h"
20
21#include <stdint.h>
22
23#ifndef NO_PYTHON
24 #include <boost/python.hpp>
25namespace bp = boost::python;
26#endif
27
29#ifndef NO_PYTHON
30 state_ = NULL;
31 release();
32#endif
33}
34
36#ifndef NO_PYTHON
37 acquire();
38#endif
39}
40
42#ifndef NO_PYTHON
43 if (state_ != NULL) PyEval_RestoreThread(state_);
44 state_ = NULL;
45#endif
46}
47
49#ifndef NO_PYTHON
50 if (Py_IsInitialized() && PyGILState_Check())
51 state_ = PyEval_SaveThread();
52 else
53 state_ = NULL;
54#endif
55}
void acquire()
Re-acquires the GIL explicitly.
~GilRelease()
Re-acquires the GIL if currently released.
GilRelease()
Constructs and releases the GIL for this scope.
void release()
Releases the GIL explicitly.