Linux, fcntl, F_SETLEASE and signals
Chris Green
cmg at dok.org
Mon Jul 26 12:40:17 EDT 2004
Jeff Epler <jepler at unpythonic.net> writes:
> What I don't see here is any handling of threads.
You're right. I'm ignorant of the thread<->signal interaction in
python.
>
> The SIGIO handler might be called at the same time as Python code is
> running in another thread. That means the call to getPending can see a
> partially modified queue, or that the queue can be modified by a signal
> while getPending is running.
If I put a thread-safe mutex around the queue, that should be good
enough? Everything that I've seen has
Py_BEGIN_ALLOW_THREADS
code
Py_END_ALLOW_THREADS
getPending()
read from queue
interrupt while reading via signal
read from modified queue
Is this where you were recommending Py_AddPendingCall? Add the
pending increment when no other fields are taking place?
Are C extensions only accessed by a single thread unless they
Py_BEGIN_ALLOW_THREADS?
Thanks,
Chris
--
Chris Green <cmg at dok.org>
Warning: time of day goes back, taking countermeasures.
More information about the Python-list
mailing list