GLibC has a method semtimedop
which allows you to perform an operation (a semaphore acquire in this case) which times out after a certain amount of time. Win32 also provides WaitForSingleObject
which provides similar functionalty.
As far as I can see there is no equivalent on OSX or other Unices. Can you suggest either the equivalent for semtimedop or a workaround to terminate a semop after a certain amount of time cleanly.