Semaphore Functions

The enhanced semaphore functions available under OS/2 Version 2.0 were described in Operating System/2. Previous versions of OS/2 provided only basic semaphore facilities with limited capability to handle multiple events. Where these semaphores were used in applications under previous versions of OS/2, they may be updated to the new OS/2 Version 2.0 semaphore facilities using the following guidelines:

  • Where a semaphore is used to serialize the access to a particular data object or system resource from multiple threads, a mutex semaphore should be used.

  • Where a semaphore is used to signal an event occurring in one thread to other threads having an interest in this event, an event semaphore should be used.

  • Where an application waits upon the clearing of one semaphore from a range of semaphores using the DosMuxWaitSem() function, this function may be replaced by the use of a muxwait semaphore.

    The muxwait semaphore has additional flexibility over the use of the DosMuxWaitSem() function with normal semaphores under previous versions of OS/2, since with a muxwait semaphore, a thread may wait for any one of a list of mutex semaphores or event semaphores to be cleared (as with previous versions), or may wait for all of the semaphores to be cleared. This latter capability is not available under OS/2 Version 1.3.

    The enhanced semaphore functions available under OS/2 Version 2.0 are described in the IBM OS/2 Version 2.0 Control Program Reference.


    [Back: Function Enhancements]
    [Next: Thread Management]