chiark / gitweb /
Acquire and release the GIL around select callbacks.
[mLib-python] / sel-timer.pyx
index 261ecde10db47df064c3bb1f2fd4c61246e93ca1..db61a6c7ee3a1ab98b30c4e3f177be0342ef7bff 100644 (file)
@@ -72,10 +72,14 @@ cdef class SelTimer:
   def timer(me, now):
     return _maybecall(me._timer, ())
 
-cdef void _timerfunc(timeval *now, void *arg):
+cdef void _timerfunc2(timeval *now, void *arg):
   cdef SelTimer st
   st = <SelTimer>arg
   st._dead()
   st.timer(_tvtofloat(now))
+cdef void _timerfunc(timeval *now, void *arg):
+  PyEval_AcquireLock()
+  _timerfunc2(now, arg)
+  PyEval_ReleaseLock()
 
 #----- That's all, folks ----------------------------------------------------