Jump to content

DosQueryMuxWaitSem

From EDM2

Syntax

rc = DosQueryMuxWaitSem( hmuxSemaphore,
                         pulSemaphoreRecords,
                         pSemaphoreRecord,
                         pflAttributes );


Parameters

HMUX hmuxSemaphore (input)

The handle of the MuxWait semaphore to be queried.

PULONG pulSemaphoreRecords (input/output)

For input, this points to a ULONG that contains the number of SEMRECORDs that may be returned in the SEMRECORD structure pointed to by pSemaphoreRecord. If this value is not enough to contain all SEMRECORDs from the MuxWait list then ERROR_PARAM_TOO_SMALL is returned and this value points to the number of records in the MuxWait list. For output, this value points to the number of SEMRECORDs actually returned.

PSEMRECORD pSemaphoreRecord (output)

A pointer to a buffer that will get the SEMRECORDs. PULONG pflAttributes (output) The attribute flags that were specified when this MuxWait semaphore was created.

  • DC_SEM_SHARED indicates the semaphore is shared.
  • DCMW_WAIT_ANY indicates the semaphore will unblock if any of the semaphores in the MuxWait list either post or release.
  • DCMW_WAIT_ALL indicates the semaphore will unblock only if all of the semaphores in the MuxWait list either post or release.


Returns

 APIRET rc

The following values can be returned

0 NO_ERROR Operation

successful

6 ERROR_INVALID_HANDLE Error, The value in phmuxSemaphore does not point to a valid

semaphore

8 ERROR_NOT_ENOUGH_MEMORY Error, The system memory limit has been exceeded
87 ERROR_INVALID_PARAMETER Error, One or more parameters is not recognized, See parameters above,

Both pszSemaphoreName and phmuxSemaphore may be NULL

105 ERROR_SEM_OWNER_DIED Error, The owner of the semaphore has died without freeing the

semaphore

289 ERROR_PARAM_TOO_SMALL Error, The value pointed to by pulSemaphoreRecords is too

small

Include Info

#define INCL_DOSSEMAPHORES
#include <os2.h>


Usage Explanation

DosQueryMuxWaitSem returns the semaphore records of the MuxWait semaphore referred to by hmuxSemaphore.

Relevant Structures

Gotchas

The process calling DosQueryMuxWaitSem must first obtain access to the semaphore in question or ERROR_INVALID_HANDLE will be returned.

Sample Code

#define INCL_DOSSEMAPHORES
#include 

HMUX  hmuxMySemaphore;     /* my semaphore handle */
ULONG ulNumSemRecords=1;   /* will get the request count for the sem */
SEMRECORD SemRecord;       /* single SEMRECORD structure */
PULONG pflAttribs;         /* pointer to attribute flags */

	/* access is gained to the semaphore in question */
	/* either by DosCreateMuxWaitSem ... */
	/* ... or by DosOpenMuxWaitSem */
	/* its handle is placed in hmuxMySemaphore */

	rc = DosQueryMuxWaitSem(  hmuxMySemaphore,
	                          ulNumSemRecords,
	                          &SemRecord,
	                          &pflAttribs );

	if (rc != 0)
	{
	  /* We got an error to take care of. */
	}

See Also

DosAddMuxWaitSem, DosCloseMuxWaitSem, DosCreateMuxWaitSem, DosDeleteMuxWaitSem, DosOpenMuxWaitSem, DosWaitMuxWaitSem