• Home
  • Raw
  • Download

Lines Matching refs:_PyRuntime

11 #define INTERVAL (_PyRuntime.ceval.gil.interval >= 1 ? _PyRuntime.ceval.gil.interval : 1)
105 return (_Py_atomic_load_explicit(&_PyRuntime.ceval.gil.locked, in gil_created()
112 MUTEX_INIT(_PyRuntime.ceval.gil.mutex); in create_gil()
114 MUTEX_INIT(_PyRuntime.ceval.gil.switch_mutex); in create_gil()
116 COND_INIT(_PyRuntime.ceval.gil.cond); in create_gil()
118 COND_INIT(_PyRuntime.ceval.gil.switch_cond); in create_gil()
120 _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil.last_holder, 0); in create_gil()
121 _Py_ANNOTATE_RWLOCK_CREATE(&_PyRuntime.ceval.gil.locked); in create_gil()
122 _Py_atomic_store_explicit(&_PyRuntime.ceval.gil.locked, 0, in create_gil()
131 COND_FINI(_PyRuntime.ceval.gil.cond); in destroy_gil()
132 MUTEX_FINI(_PyRuntime.ceval.gil.mutex); in destroy_gil()
134 COND_FINI(_PyRuntime.ceval.gil.switch_cond); in destroy_gil()
135 MUTEX_FINI(_PyRuntime.ceval.gil.switch_mutex); in destroy_gil()
137 _Py_atomic_store_explicit(&_PyRuntime.ceval.gil.locked, -1, in destroy_gil()
139 _Py_ANNOTATE_RWLOCK_DESTROY(&_PyRuntime.ceval.gil.locked); in destroy_gil()
144 _Py_ANNOTATE_RWLOCK_DESTROY(&_PyRuntime.ceval.gil.locked); in recreate_gil()
151 if (!_Py_atomic_load_relaxed(&_PyRuntime.ceval.gil.locked)) in drop_gil()
158 _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil.last_holder, in drop_gil()
162 MUTEX_LOCK(_PyRuntime.ceval.gil.mutex); in drop_gil()
163 _Py_ANNOTATE_RWLOCK_RELEASED(&_PyRuntime.ceval.gil.locked, /*is_write=*/1); in drop_gil()
164 _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil.locked, 0); in drop_gil()
165 COND_SIGNAL(_PyRuntime.ceval.gil.cond); in drop_gil()
166 MUTEX_UNLOCK(_PyRuntime.ceval.gil.mutex); in drop_gil()
169 if (_Py_atomic_load_relaxed(&_PyRuntime.ceval.gil_drop_request) && in drop_gil()
172 MUTEX_LOCK(_PyRuntime.ceval.gil.switch_mutex); in drop_gil()
175 &_PyRuntime.ceval.gil.last_holder) in drop_gil()
183 COND_WAIT(_PyRuntime.ceval.gil.switch_cond, in drop_gil()
184 _PyRuntime.ceval.gil.switch_mutex); in drop_gil()
186 MUTEX_UNLOCK(_PyRuntime.ceval.gil.switch_mutex); in drop_gil()
198 MUTEX_LOCK(_PyRuntime.ceval.gil.mutex); in take_gil()
200 if (!_Py_atomic_load_relaxed(&_PyRuntime.ceval.gil.locked)) in take_gil()
203 while (_Py_atomic_load_relaxed(&_PyRuntime.ceval.gil.locked)) { in take_gil()
207 saved_switchnum = _PyRuntime.ceval.gil.switch_number; in take_gil()
208 COND_TIMED_WAIT(_PyRuntime.ceval.gil.cond, _PyRuntime.ceval.gil.mutex, in take_gil()
213 _Py_atomic_load_relaxed(&_PyRuntime.ceval.gil.locked) && in take_gil()
214 _PyRuntime.ceval.gil.switch_number == saved_switchnum) { in take_gil()
222 MUTEX_LOCK(_PyRuntime.ceval.gil.switch_mutex); in take_gil()
225 _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil.locked, 1); in take_gil()
226 _Py_ANNOTATE_RWLOCK_ACQUIRED(&_PyRuntime.ceval.gil.locked, /*is_write=*/1); in take_gil()
229 &_PyRuntime.ceval.gil.last_holder)) in take_gil()
231 _Py_atomic_store_relaxed(&_PyRuntime.ceval.gil.last_holder, in take_gil()
233 ++_PyRuntime.ceval.gil.switch_number; in take_gil()
237 COND_SIGNAL(_PyRuntime.ceval.gil.switch_cond); in take_gil()
238 MUTEX_UNLOCK(_PyRuntime.ceval.gil.switch_mutex); in take_gil()
240 if (_Py_atomic_load_relaxed(&_PyRuntime.ceval.gil_drop_request)) { in take_gil()
247 MUTEX_UNLOCK(_PyRuntime.ceval.gil.mutex); in take_gil()
253 _PyRuntime.ceval.gil.interval = microseconds; in _PyEval_SetSwitchInterval()
258 return _PyRuntime.ceval.gil.interval; in _PyEval_GetSwitchInterval()