Jump to content

DosPostEventSem: Difference between revisions

From EDM2
Created page with "=== Syntax === rc = DosPostEventSem( ''hevSemaphore'' ); === Parameters === HEV ''hevSemaphore'' (input) The handle of the semaphore to be posted. === Returns === AP..."
 
Ak120 (talk | contribs)
No edit summary
Line 1: Line 1:
=== Syntax ===
== Syntax ==
 
  rc = DosPostEventSem( ''hevSemaphore'' );
  rc = DosPostEventSem( ''hevSemaphore'' );


=== Parameters ===
=== Parameters ===
  HEV ''hevSemaphore'' (input)
HEV ''hevSemaphore'' (input)
The handle of the semaphore to be posted.
The handle of the semaphore to be posted.
   
   
=== Returns ===
=== Returns ===
  APIRET rc
APIRET rc
The following values can be returned
The following values can be returned:
   
{|class="wikitable"
{| border="1"
|-
|0
|0
|NO_ERROR
|NO_ERROR
Line 29: Line 25:
|ERROR_ALREADY_POSTED
|ERROR_ALREADY_POSTED
|Error, not fatal, The semaphore has already been posted, The post count has been increased by one.
|Error, not fatal, The semaphore has already been posted, The post count has been increased by one.
|}
|}
=== Include Info ===
 
#define INCL_DOSSEMAPHORES
#include <os2.h>
 
 
=== Usage Explanation ===
 
DosPostEventSem increments, by one (1), the post count of the event
semaphore referred to by ''hevSemaphore''.  If the semaphore has already
been posted since the last reset, ERROR_ALREADY_POSTED is returned.  This is
not fatal and the post count is still incremented.


== Usage Explanation ==
DosPostEventSem increments, by one (1), the post count of the event semaphore referred to by ''hevSemaphore''. If the semaphore has already been posted since the last reset, ERROR_ALREADY_POSTED is returned. This is not fatal and the post count is still incremented.


=== Relevant Structures ===
=== Gotchas ===
=== Gotchas ===
 
The process calling DosPostEventSem must first obtain access to the semaphore in question or ERROR_INVALID_HANDLE will be returned.
The process calling DosPostEventSem must first obtain access to
the semaphore in question or ERROR_INVALID_HANDLE will be returned.
 


=== Sample Code ===
=== Sample Code ===
<pre>
<pre>
#define INCL_DOSSEMAPHORES
#define INCL_DOSSEMAPHORES
#include  
#include <os2.h>


HEV  hevMySemaphore;    /* MySemaphore handle */
HEV  hevMySemaphore;    /* MySemaphore handle */
Line 74: Line 55:
}
}
</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:DosQueryEventSem|CPI:DosQueryEventSem]],
*[[DosQueryEventSem]]
[[OS2 API:CPI:DosResetEventSem|CPI:DosResetEventSem]],
*[[DosResetEventSem]]  
[[OS2 API:CPI:DosWaitEventSem|CPI:DosWaitEventSem]]
*[[DosWaitEventSem]]
 


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

Revision as of 13:00, 21 November 2016

Syntax

rc = DosPostEventSem( hevSemaphore );

Parameters

HEV hevSemaphore (input)

The handle of the semaphore to be posted.

Returns

APIRET rc

The following values can be returned:

0 NO_ERROR Semaphore posted 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
298 ERROR_TOO_MANY_POSTS Error, The call increased the post count beyond the system limit of 65535 posts.
299 ERROR_ALREADY_POSTED Error, not fatal, The semaphore has already been posted, The post count has been increased by one.

Usage Explanation

DosPostEventSem increments, by one (1), the post count of the event semaphore referred to by hevSemaphore. If the semaphore has already been posted since the last reset, ERROR_ALREADY_POSTED is returned. This is not fatal and the post count is still incremented.

Gotchas

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

Sample Code

#define INCL_DOSSEMAPHORES
#include <os2.h>

HEV  hevMySemaphore;     /* MySemaphore handle */

	/* 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 = DosPostEventSem(hevMySemaphore);

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

See Also