Jump to content

DosQueryEventSem: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Line 1: Line 1:
=== Syntax ===
=== Syntax ===
  rc = DosQueryEventSem( ''hevSemaphore'',  
  rc = DosQueryEventSem( ''hevSemaphore'',  
                         ''pulPostCount'' );
                         ''pulPostCount'' );


=== Parameters ===
=== Parameters ===
Line 13: Line 11:


A pointer to the ULONG that is to get the post count of the queried event semaphore. The post count is the number of [[OS2 API:CPI:DosPostEventSem|DosPostEventSem]] calls that have been issued for the event semaphore described by ''hevSemaphore''.
A pointer to the ULONG that is to get the post count of the queried event semaphore. The post count is the number of [[OS2 API:CPI:DosPostEventSem|DosPostEventSem]] calls that have been issued for the event semaphore described by ''hevSemaphore''.
   
   
=== 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 34: Line 30:
|}   
|}   
=== Include Info ===
=== Include Info ===
  #define INCL_DOSSEMAPHORES
  #define INCL_DOSSEMAPHORES
  #include <os2.h>
  #include <os2.h>
 


=== Usage Explanation ===
=== Usage Explanation ===
 
DosQueryEventSem returns the post count of the Event semaphore referred to by ''hevSemaphore''.
DosQueryEventSem returns the post
count of the Event semaphore referred to by ''hevSemaphore''.
 
 
=== Relevant Structures ===
   
   
=== Gotchas ===
=== Gotchas ===
 
The process calling DosQueryEventSem must first obtain access to the semaphore in question or ERROR_INVALID_HANDLE will be returned.
The process calling DosQueryEventSem must first obtain access to
the semaphore in question or ERROR_INVALID_HANDLE will be returned.
 


=== Sample Code ===
=== Sample Code ===
Line 74: Line 60:
}
}
</pre>
</pre>
=== See Also ===
=== See Also ===
[[OS2 API:CPI:DosCloseEventSem|DosCloseEventSem]],
*[[DosCloseEventSem]]
[[OS2 API:CPI:DosCreateEventSem|DosCreateEventSem]],
*[[DosCreateEventSem]]
[[OS2 API:CPI:DosOpenEventSem|DosOpenEventSem]],
*[[DosOpenEventSem]]
[[OS2 API:CPI:DosPostEventSem|DosPostEventSem]] [[OS2 API:CPI:DosResetEventSem|DosResetEventSem]] [[OS2 API:CPI:DosWaitEventSem|DosWaitEventSem]]  
*[[DosPostEventSem]]
*[[DosResetEventSem]]
*[[DosWaitEventSem]]  


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

Revision as of 13:03, 21 November 2016

Syntax

rc = DosQueryEventSem( hevSemaphore, 
                       pulPostCount );

Parameters

HEV hevSemaphore (input)

The handle (HEV) of the semaphore to be queried.

PUL pulPostCount (output)

A pointer to the ULONG that is to get the post count of the queried event semaphore. The post count is the number of DosPostEventSem calls that have been issued for the event semaphore described by hevSemaphore.

Returns

APIRET rc

The following values can be returned

0 NO_ERROR Semaphore queried successfully
6 ERROR_INVALID_HANDLE Error, The value in phevSemaphore does not point to a valid semaphore, The calling process must first have access to the semaphore in question
87 ERROR_INVALID_PARAMETER Error, One or more parameters is not recognized, See parameters above

Include Info

#define INCL_DOSSEMAPHORES
#include <os2.h>

Usage Explanation

DosQueryEventSem returns the post count of the Event semaphore referred to by hevSemaphore.

Gotchas

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

Sample Code

#define INCL_DOSSEMAPHORES
#include 

HEV   hevMySemaphore;      /* my semaphore handle */
ULONG ulRequestCount;      /* will get the request count for the sem */

	/* access is gained to the semaphore in question */
	/* either by DosCreateEventSem ... */
	/* ... or by DosOpenEventSem */
	/* its handle is placed in hevMySemaphore */

	rc = DosQueryEventSem(hevMySemaphore,
	                      &ulRequestCount);

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

See Also