Linux, fcntl, F_SETLEASE and signals

Chris Green cmg at
Mon Jul 26 18:40:17 CEST 2004

Jeff Epler <jepler at> writes:

> What I don't see here is any handling of threads.

You're right.  I'm ignorant of the thread<->signal interaction in

> 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


  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

Chris Green <cmg at>
Warning: time of day goes back, taking countermeasures.

More information about the Python-list mailing list