I have just committed changes to create a platform-independent internal
API for semaphores, along the lines discussed yesterday.
At this point, the Darwin (Mac OS X), BeOS, and QNX4 ports are probably
broken. I will fix the Darwin port (probably not till tomorrow though);
volunteers to clean up the BeOS and QNX4 ports are needed.
BTW, there is a quick hack attempt at a POSIX-semaphore-based
implementation in src/backend/port/posix_sema.c. I have not tested
this yet, but expect to do so as part of fixing the Darwin port.
regards, tom lane