Jump to content

DosQueryMuxWaitSem: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Line 1: Line 1:
DosQueryMuxWaitSem returns the semaphore records of the MuxWait semaphore referred to by ''hmuxSemaphore''.
=== Syntax ===
=== Syntax ===
  rc = DosQueryMuxWaitSem( ''hmuxSemaphore'',
  rc = DosQueryMuxWaitSem( ''hmuxSemaphore'',
                           ''pulSemaphoreRecords'',
                           ''pulSemaphoreRecords'',
                           ''pSemaphoreRecord'',
                           ''pSemaphoreRecord'',
                           ''pflAttributes'' );
                           ''pflAttributes'' );


=== Parameters ===
=== Parameters ===
'''HMUX ''hmuxSemaphore'' (input)'''
;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  
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''.
''pSemaphoreRecord''.
If this value is not enough to contain all SEMRECORDs from the MuxWait list  
: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.
then ERROR_PARAM_TOO_SMALL is returned and this value points to the number of
;PSEMRECORD ''pSemaphoreRecord'' (output):A pointer to a buffer that will get the SEMRECORDs.
records in the MuxWait list. For output, this value points to the
;PULONG ''pflAttributes'' (output):The attribute flags that were specified when this MuxWait semaphore was created.
number of SEMRECORDs actually returned.
:* 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.
'''PSEMRECORD ''pSemaphoreRecord'' (output)'''
:* DCMW_WAIT_ALL indicates the semaphore will unblock only if ''all'' of the semaphores in the MuxWait list either post or release.
 
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 ===
=== Returns ===
  APIRET rc
APIRET rc
The following values can be returned
The following values can be returned
     
{|class="wikitable"
{| border="1"
|-
|-
|0
|0
Line 68: Line 51:
|Error, The value pointed to by ''pulSemaphoreRecords'' is too  
|Error, The value pointed to by ''pulSemaphoreRecords'' is too  
small
small
|}
|}
 
=== Include Info ===
=== Include Info ===
  #define INCL_DOSSEMAPHORES
  #define INCL_DOSSEMAPHORES
  #include <os2.h>
  #include <os2.h>
 
 
=== Usage Explanation ===
DosQueryMuxWaitSem returns the semaphore records of the MuxWait semaphore
referred to by ''hmuxSemaphore''.
 
=== Relevant Structures ===
   
   
=== Gotchas ===
=== Gotchas ===
The process calling DosQueryMuxWaitSem must first obtain access to the semaphore in question or ERROR_INVALID_HANDLE will be returned.


The process calling DosQueryMuxWaitSem must first obtain access to
the semaphore in question or ERROR_INVALID_HANDLE will be returned.
=== Sample Code ===
=== Sample Code ===
<pre>
<pre>
Line 110: Line 85:
}
}
</pre>
</pre>
=== See Also ===
=== See Also ===
[[OS2 API:CPI:DosAddMuxWaitSem|DosAddMuxWaitSem]],
*[[DosAddMuxWaitSem]]
[[OS2 API:CPI:DosCloseMuxWaitSem|DosCloseMuxWaitSem]],
*[[DosCloseMuxWaitSem]]
[[OS2 API:CPI:DosCreateMuxWaitSem|DosCreateMuxWaitSem]],
*[[DosCreateMuxWaitSem]]
[[OS2 API:CPI:DosDeleteMuxWaitSem|DosDeleteMuxWaitSem]],
*[[DosDeleteMuxWaitSem]]
[[OS2 API:CPI:DosOpenMuxWaitSem|DosOpenMuxWaitSem]],
*[[DosOpenMuxWaitSem]]
[[OS2 API:CPI:DosWaitMuxWaitSem|DosWaitMuxWaitSem]]  
*[[DosWaitMuxWaitSem]]


[[Category:The OS/2 API Project]]
[[Category:Dos]]

Revision as of 18:13, 23 November 2016

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

Include Info

#define INCL_DOSSEMAPHORES
#include <os2.h>

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