Jump to content

DosResetEventSem

From EDM2
Revision as of 05:16, 17 May 2016 by Martini (talk | contribs) (Created page with "=== Syntax === rc = DosResetEventSem( ''hevSemaphore'', ''pulPostCount'' ); === Parameters === '''HEV ''hevSemaphore'' (input)''' The handle of t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.

Relevant Structures

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

CPI:DosCloseEventSem, CPI:DosCreateEventSem, CPI:DosOpenEventSem, CPI:DosPostEventSem CPI:DosQueryEventSem, CPI:DosWaitEventSem