DosQueryMuxWaitSem: Difference between revisions
Appearance
mNo edit summary |
mNo edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 19: | Line 19: | ||
=== Returns === | === Returns === | ||
;APIRET rc:The following values can be returned | |||
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 | |||
successful | |||
semaphore | |||
Both ''pszSemaphoreName'' and ''phmuxSemaphore'' may be NULL | |||
semaphore | |||
small | |||
=== Gotchas === | === Gotchas === | ||
Line 63: | Line 33: | ||
<pre> | <pre> | ||
#define INCL_DOSSEMAPHORES | #define INCL_DOSSEMAPHORES | ||
#include | #include <os2.h> | ||
HMUX | HMUX hmuxMySemaphore; /* my semaphore handle */ | ||
ULONG ulNumSemRecords=1; | ULONG ulNumSemRecords=1; /* will get the request count for the sem */ | ||
SEMRECORD SemRecord; | SEMRECORD SemRecord; /* single SEMRECORD structure */ | ||
PULONG pflAttribs; | 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( | rc = DosQueryMuxWaitSem( hmuxMySemaphore, | ||
ulNumSemRecords, | |||
&SemRecord, | |||
&pflAttribs ); | |||
if (rc != 0) | if (rc != 0) |
Latest revision as of 18:54, 1 December 2018
DosQueryMuxWaitSem returns the semaphore records of the MuxWait semaphore referred to by hmuxSemaphore.
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
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 <os2.h> 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. */ }