signals (again)

bill bill.pursell at gmail.com
Thu Aug 11 02:39:38 EDT 2005


How does that help?  I interpret "use asynchronous calls" to mean "use
fcntl to set an FN_NOTIFY on the directory in order to be alerted when
something needs to be done."   But the method of doing that which I
outlined above has a critical section in which the incoming signal will
not be noticed.  All of the solutions I can think of for getting around
it involve a lot of acrobatics that I'm fairly certain aren't
necessary, and more to the point I don't think they actually solve the
problem.  There is always a section in which the signal arrives just
before the pause, so it doesn't wake us up out of the pause as it is
intended to.  We can set globals in the signal handler, and then check
them right before the pause, but if they get set after we check, then
we're hosed.  I was hoping that perhaps the following code might be
atomic:

if notify_occurred or signal.pause():

but I'm almost certain that it's not.

The problem is localized, so I don't see how invoking a seperate thread
is useful.  Could you elaborate on how you think that will help?




More information about the Python-list mailing list