Browse Prior Art Database

Enhanced OS/2 Semaphore Support

IP.com Disclosure Number: IPCOM000122544D
Original Publication Date: 1991-Dec-01
Included in the Prior Art Database: 2005-Apr-04
Document File: 3 page(s) / 106K

Publishing Venue

IBM

Related People

Acker, W: AUTHOR [+2]

Abstract

The OS/2* Presentation Manager* application programming interface set includes a routine(DosMuxSemWait) to block a thread's processing until a specified asynchronous event or a specified time-out period has elapsed. This routine is useful when tracking a small number of asynchronous events but is limited to tracking a maximum of 16 such events. (The structure of this routine can be seen in Fig. 1.) The following describes a routine that replaces DosMuxSemWait while extending the maximum number of tracked events from 16 to 226.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 52% of the total text.

Enhanced OS/2 Semaphore Support

      The OS/2* Presentation Manager* application programming
interface set includes a routine(DosMuxSemWait) to block a thread's
processing until a specified asynchronous event or a specified
time-out period has elapsed.  This routine is useful when tracking a
small number of asynchronous events but is limited to tracking a
maximum of 16 such events. (The structure of this routine can be seen
in Fig. 1.)  The following describes a routine that replaces
DosMuxSemWait while extending the maximum number of tracked events
from 16 to 226.

      The method used to extend the maximum number of tracked events
makes use of the native OS/2 thread constructs, each of which utilize
DosMuxSemWait therein.  Each event within the DosMuxSemWaits is
tracked through another OS/2 construct called a semaphore handle.

      The actual implementation uses the current operating thread as
the "parent" thread.  It is this parent that performs all of the
error checking, set-up of "child" threads, and result reporting back
to the caller.

      The error checking processing includes insuring that the number
of events to be tracked is within range (greater than 1 and less than
226).  In addition, a check is made to insure that all of the
semaphore handles are valid (not NULL).  If a problem is found, an
error is reported back to the calling routine and no further
processing is performed.

      If no input errors have occurred, the first step within the new
routine is to set-up the parent and child threads for tracking the
events.  If the number of events to track is 16 or less, a single
invocation of DosMuxSemWait is used within the parent thread and no
child threads are created.

      If more than 16 events are to be tracked, a series of child
threads is created.  For each child, the parent will allocate an
internal event which the child will use to notify the parent that an
event within the child has been triggered.  This event is then
tracked from the parent thread.  In addition, each thread is
allocated a memory location wherein the index of the triggered thread
will be placed.

      Each child tracks 15 of the asynchronous events passed to the
routine.  The sixteenth event wi...