[Python-Dev] POSIX thread code

Tim Peters tim.one@comcast.net
Fri, 15 Mar 2002 04:04:37 -0500


[Gerald S. Williams
 Sent: Monday, March 04, 2002 10:44 AM
]
> I submitted patch request 525532 that will enable semaphore
> use in thread_pthread.h if _POSIX_SEMAPHORES is defined. It
> includes proper checking of error codes and looping if EINTR
> is received (as you rightly pointed out).

Cool!  I gave it a +1, but I'm not on a pthreads platform and someone who is
needs to continue the process.

> I didn't add any specific checks for a keyboard interrupt. Checks
> could be added in the loop for specific platforms as needed.

I'm deadly opposed to letting a keyboard interrupt break out of a wait for a
Python lock.

> I'm not sure if this is an issue anyway. To quote the POSIX
> standard (ISO/IEC 9945-l: 1996 aka ANSI/IEEE Std 1003.1, 1996
> Edition):
>  If a signal is delivered to a thread waiting for a mutex,
>  upon return from the signal handler the thread shall resume
>  waiting for the mutex as if it was not interrupted.
> and:
>  If a signal is delivered to a thread waiting for a condition
>  variable, upon return from the signal handler the thread shall
>  resume waiting for the condition variable as if it was not
>  interrupted, or it shall return zero due to spurious wakeup.

Sorry, I don't grasp what the point of this quoting was, unless it was a
roundabout way of merely confirming that keyboard interrupts can't break out
of a wait for a Python lock today (which was known and said before).