rogue
Loading...
Searching...
No Matches
src
rogue
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>
25
namespace
bp = boost::python;
26
#endif
27
28
rogue::GilRelease::GilRelease
() {
29
#ifndef NO_PYTHON
30
state_ = NULL;
31
release
();
32
#endif
33
}
34
35
rogue::GilRelease::~GilRelease
() {
36
#ifndef NO_PYTHON
37
acquire();
38
#endif
39
}
40
41
void
rogue::GilRelease::acquire
() {
42
#ifndef NO_PYTHON
43
if
(state_ != NULL) PyEval_RestoreThread(state_);
44
state_ = NULL;
45
#endif
46
}
47
48
void
rogue::GilRelease::release
() {
49
#ifndef NO_PYTHON
50
if
(Py_IsInitialized() && PyGILState_Check())
51
state_ = PyEval_SaveThread();
52
else
53
state_ = NULL;
54
#endif
55
}
Directives.h
GilRelease.h
rogue::GilRelease::acquire
void acquire()
Re-acquires the GIL explicitly.
Definition
GilRelease.cpp:41
rogue::GilRelease::~GilRelease
~GilRelease()
Re-acquires the GIL if currently released.
Definition
GilRelease.cpp:35
rogue::GilRelease::GilRelease
GilRelease()
Constructs and releases the GIL for this scope.
Definition
GilRelease.cpp:28
rogue::GilRelease::release
void release()
Releases the GIL explicitly.
Definition
GilRelease.cpp:48
Generated by
1.9.8