Jump to content

DosResetEventSem: Difference between revisions

From EDM2
Created page with "=== Syntax === rc = DosResetEventSem( ''hevSemaphore'', ''pulPostCount'' ); === Parameters === '''HEV ''hevSemaphore'' (input)''' The handle of t..."
 
Ak120 (talk | contribs)
mNo edit summary
Line 1: Line 1:
=== Syntax ===
=== Syntax ===
  rc = DosResetEventSem( ''hevSemaphore'',  
  rc = DosResetEventSem( ''hevSemaphore'',  
                         ''pulPostCount'' );
                         ''pulPostCount'' );


=== Parameters ===
=== Parameters ===
'''HEV ''hevSemaphore'' (input)'''
;HEV ''hevSemaphore'' (input)
 
:The handle of the semaphore to be reset.
The handle of the semaphore to be reset.
;PUL ''pulPostCount'' (output)
 
:The post count of the semaphore that was reset. This can ''not'' be set to NULL, it must be a valid pointer to ULONG.
'''PUL ''pulPostCount'' (output)'''


The post count of the semaphore that was reset. This can ''not'' be
set to NULL, it must be a valid pointer to ULONG.
=== 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 33: Line 25:
|ERROR_ALREADY_RESET
|ERROR_ALREADY_RESET
|Error, The semaphore is already reset, no posts have occurred since last reset
|Error, The semaphore is already reset, no posts have occurred since last reset
|}
|}
 
=== Include Info ===
=== Include Info ===
  #define INCL_DOSSEMAPHORES
  #define INCL_DOSSEMAPHORES
  #include <os2.h>
  #include <os2.h>
 


=== Usage Explanation ===
=== Usage Explanation ===
DosResetEventSem resets the post count of an event semaphore.
DosResetEventSem resets the post count of an event semaphore.
=== Relevant Structures ===
   
   
=== Gotchas ===
=== Gotchas ===
The process calling DosResetEventSem must first obtain access to the semaphore in question or ERROR_INVALID_HANDLE will be returned.


The process calling DosResetEventSem must first obtain access to
the semaphore in question or ERROR_INVALID_HANDLE will be returned.
=== Sample Code ===
=== Sample Code ===
<pre>  
<pre>  
Line 72: Line 60:
}
}
</pre>
</pre>
=== See Also ===
=== See Also ===
[[OS2 API:CPI:DosCloseEventSem|CPI:DosCloseEventSem]],
*[[DosCloseEventSem]]
[[OS2 API:CPI:DosCreateEventSem|CPI:DosCreateEventSem]],
*[[DosCreateEventSem]]
[[OS2 API:CPI:DosOpenEventSem|CPI:DosOpenEventSem]],
*[[DosOpenEventSem]]
[[OS2 API:CPI:DosPostEventSem|CPI:DosPostEventSem]] [[OS2 API:CPI:DosQueryEventSem|CPI:DosQueryEventSem]],
*[[DosPostEventSem]]
[[OS2 API:CPI:DosWaitEventSem|CPI:DosWaitEventSem]]  
*[[DosQueryEventSem]]
*[[DosWaitEventSem]]


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

Revision as of 13:19, 21 November 2016

Syntax

rc = DosResetEventSem( hevSemaphore, 
                       pulPostCount );

Parameters

HEV hevSemaphore (input)
The handle of the semaphore to be reset.
PUL pulPostCount (output)
The post count of the semaphore that was reset. This can not be set to NULL, it must be a valid pointer to ULONG.

Returns

APIRET rc

The following values can be returned

0 NO_ERROR Semaphore released 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
300 ERROR_ALREADY_RESET Error, The semaphore is already reset, no posts have occurred since last reset

Include Info

#define INCL_DOSSEMAPHORES
#include <os2.h>

Usage Explanation

DosResetEventSem resets the post count of an event semaphore.

Gotchas

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

Sample Code

 
#define INCL_DOSSEMAPHORES
#include 

HEV  hevMySemaphore;     /* MySemaphore handle */
ULONG PostCount          /* storage for the post count of MySemaphore */

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

	/* process becomes owner of semaphore */
	/* by way of successful call to DosRequestEventSem */

	rc = DosResetEventSem(hevMySemaphore, &PostCount);

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

See Also