Jump to content

DosDeleteMuxWaitSem: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Line 1: Line 1:
DosDeleteMuxWaitSem deletes a specified semaphore from a muxwait list.
=== Syntax ===
=== Syntax ===
  rc = DosDeleteMuxWaitSem(  ''phmuxSemaphore'',
  rc = DosDeleteMuxWaitSem(  ''phmuxSemaphore'',
                             ''hsemSemaphore'' );
                             ''hsemSemaphore'' );


=== Parameters ===
=== Parameters ===
PHMUX ''phmuxSemaphore'' (input)
;PHMUX ''phmuxSemaphore'' (input):This is a pointer to the HMUX that will get the handle to the new semaphore.
 
;HSEM ''hsemSemaphore'' (input):The handle to the semaphore to be removed from the muxwait list. It must be cast to HSEM from either HEV or HMTX.
This is a pointer to the HMUX that will get the handle to the new semaphore.
 
HSEM ''hsemSemaphore'' (input)
 
The handle to the semaphore to be removed from the muxwait list. it must
be cast to HSEM from either HEV or HMTX.
 
   
   
=== 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
|Operation was  
|Operation was successful.
successful.
|-
|-
|6
|6
|ERROR_INVALID_HANDLE
|ERROR_INVALID_HANDLE
|Error, The calling process must first have access to the shared semaphore  
|Error, The calling process must first have access to the shared semaphore in question before adding it to the muxwait list
in question before adding it to the muxwait list
|-
|-
|286
|286
|ERROR_EMPTY_MUXWAIT
|ERROR_EMPTY_MUXWAIT
|Error, The MuxWait semaphore ''hmuxSemaphore'' is empty
|Error, The MuxWait semaphore ''hmuxSemaphore'' is empty
|}  
|}
 
=== Include Info ===
=== Include Info ===
  #define INCL_DOSSEMAPHORES
  #define INCL_DOSSEMAPHORES
  #include <os2.h>
  #include <os2.h>
 


=== Usage Explanation ===
DosDeleteMuxWaitSem deletes a specified semaphore from a muxwait list.
=== Relevant Structures ===
=== Gotchas ===
=== Gotchas ===
This may only be called from a process that has gained proper access to the MuxWait semaphore via either [[DosCreateMuxWaitSem]] or [[DosOpenMuxWaitSem]].
If the deleted semaphore is the last semaphore in the muxwait list, all threads blocking on the MuxWait semaphore are unblocked.


This may only be called from a process that has gained proper access to the
If the deleted semaphore is the only "hold-out" in a MuxWait semaphore with the DCMW_WAIT_ALL attribute, all threads blocked on the MuxWait semaphore will be unblocked.
MuxWait semaphore via either [[DosCreateMuxWaitSem]]
or [[DosOpenMuxWaitSem]].
If the deleted semaphore is the last semaphore in the muxwait list, all threads
blocking on the MuxWait semaphore are unblocked.
 
 
If the deleted semaphore is the only "hold-out" in a MuxWait semaphore with
the DCMW_WAIT_ALL attribute, all threads blocked on the MuxWait semaphore  
will be unblocked.
 


=== Sample Code ===
=== Sample Code ===
Line 82: Line 57:
}
}
</pre>
</pre>
=== See Also ===
=== See Also ===
[[OS2 API:CPI:DosAddMuxWaitSem|DosAddMuxWaitSem]],
*[[DosAddMuxWaitSem]]
[[OS2 API:CPI:DosCloseMuxWaitSem|DosCloseMuxWaitSem]],
*[[DosCloseMuxWaitSem]]
[[OS2 API:CPI:DosCreateMuxWaitSem|DosCreateMuxWaitSem]] [[OS2 API:CPI:DosOpenMuxWaitSem|DosOpenMuxWaitSem]],
*[[DosCreateMuxWaitSem]]
[[OS2 API:CPI:DosQueryMuxWaitSem|DosQueryMuxWaitSem]],
*[[DosOpenMuxWaitSem]]
[[OS2 API:CPI:DosWaitMuxWaitSem|DosWaitMuxWaitSem]]  
*[[DosQueryMuxWaitSem]]
 
*[[DosWaitMuxWaitSem]]


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

Revision as of 17:55, 23 November 2016

DosDeleteMuxWaitSem deletes a specified semaphore from a muxwait list.

Syntax

rc = DosDeleteMuxWaitSem(  phmuxSemaphore,
                           hsemSemaphore );

Parameters

PHMUX phmuxSemaphore (input)
This is a pointer to the HMUX that will get the handle to the new semaphore.
HSEM hsemSemaphore (input)
The handle to the semaphore to be removed from the muxwait list. It must be cast to HSEM from either HEV or HMTX.

Returns

APIRET rc

The following values can be returned

0 NO_ERROR Operation was successful.
6 ERROR_INVALID_HANDLE Error, The calling process must first have access to the shared semaphore in question before adding it to the muxwait list
286 ERROR_EMPTY_MUXWAIT Error, The MuxWait semaphore hmuxSemaphore is empty

Include Info

#define INCL_DOSSEMAPHORES
#include <os2.h>

Gotchas

This may only be called from a process that has gained proper access to the MuxWait semaphore via either DosCreateMuxWaitSem or DosOpenMuxWaitSem. If the deleted semaphore is the last semaphore in the muxwait list, all threads blocking on the MuxWait semaphore are unblocked.

If the deleted semaphore is the only "hold-out" in a MuxWait semaphore with the DCMW_WAIT_ALL attribute, all threads blocked on the MuxWait semaphore will be unblocked.

Sample Code

#define INCL_DOSSEMAPHORES
#include 

HMUX   hmuxMySemaphore;       /* my muxwait semaphore handle */
HMTX   hmtxMyOtherSemaphore;  /* my mutex semaphore handle */

	/* wave the magic wand and... */
	/* hmuxMySemaphore contains a valid muxwait sem handle */
	/* hmtxMyOtherSemaphore contains a valid mutex sem handle */

	rc = DosDeleteMuxWaitSem( nmuxMySemaphore,
	                          (HSEM)hmtxMyOtherSemaphore);

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

See Also