Alexandria  2.25.0
SDC-CH common library for the Euclid project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GIL.cpp
Go to the documentation of this file.
1 
19 #include "Pyston/GIL.h"
20 
21 namespace Pyston {
22 
23 static size_t s_lock_count = 0;
24 
26  m_state = PyGILState_Ensure();
27  ++s_lock_count;
28 }
29 
31  PyGILState_Release(m_state);
32 }
33 
35  return s_lock_count;
36 }
37 
38 GILReleaser::GILReleaser(PyGILState_STATE& state) : m_state(state) {
39  PyGILState_Release(m_state);
40 }
41 
42 GILReleaser::GILReleaser(GILLocker& locker) : m_state(locker.m_state) {
43  PyGILState_Release(m_state);
44 }
45 
47  m_state = PyGILState_Ensure();
48  ++s_lock_count;
49 }
50 
51 } // end of namespace Pyston
GILReleaser(PyGILState_STATE &state)
Definition: GIL.cpp:38
static size_t getLockCount()
Definition: GIL.cpp:34
static size_t s_lock_count
Definition: GIL.cpp:23
PyGILState_STATE m_state
Definition: GIL.h:38
PyGILState_STATE & m_state
Definition: GIL.h:54