Message 75691 - Python tracker (original) (raw)

At CCP We have started using the Py_AddPendingCall() mechanism to signal python about a completed IO operation. However, we noticed that the existing mechanism was hoplelessly un- thread safe. This is bad, since on Windows at least, it is very convenient to have such callbacks happen on an arbitrary thread from the system's thread pool. I submit a thread-safe implementation instead to be used if WITH_THREAD is defined. This allows Py_AddPendingCall() to be called from any thread, from any context, even from a PendingCall callback itself.