[Gerald S. Williams]
I submitted another patch to the POSIX threads code. It is under SourceForge as patch number 533681.
This tells Python to explicitly use the POSIX semaphore code for Cygwin. I had inadvertently left a remnant in my version of thread.c that forced _POSIX_SEMAPHORES to be defined for Cygwin.
It turns out _POSIX_SEMAPHORES is only set if __rtems__ is defined. At the time I didn't know what that meant but thought it must have been defined since I got the correct code.
I don't understand. If Cygwin requires _rtems_ in order that _POSIX_SEMAPHORES be defined, then either Cygwin has a bug here, or Cygwin needs _rtems_ if you want to use real-time gimmicks like semaphores. In either case, I don't think it's Python's place to second-guess the Cygwin team: report it as a bug to Cygwin, or do whatever they recommend to get _rtems_ defined in the Cygwin build.