[ Home | Alpha index | Topic index | Tutorials | Download | Feedback ]

The OS/2 API Project

DosOpenMuxWaitSem

[ Syntax | Params | Returns | Include | Usage | Structs | Gotchas | Code | Also ]

Syntax

rc = DosOpenMuxWaitSem( pszSemaphoreName, phmuxSemaphore );

Parameters

PSZ pszSemaphoreName (input)
This is a pointer to NULL terminated string containing the name of the shared MuxWait semaphore to access. If this value is NULL then the semaphore to access is specified in phmuxSemaphore.

PHMUX phmuxSemaphore (input/output)
For input, this value is a pointer to the MuxWait semaphore handle that should be openned if pszSemaphoreName is NULL. If pszSemaphoreName is not NULL then this value must be NULL on input. For output, this is a pointer to the MuxWait semaphore handle (HMUX) to the openned semaphore.

Returns

APIRET rc
The following values can be returned

Include Info

#define INCL_DOSSEMAPHORES
#include <os2.h>

Usage Explanation

DosOpenMuxWaitSem gains access to a shared MuxWait semaphore.

Relevant Structures

Gotchas

The process that created the MuxWait semaphore does not need to call this.

The process wishing to use this function must first have gained access to all semaphores in the muxwait list of the MuxWait semaphore to which access is intended or ERROR_INVALID_HANDLE will be returned.

Sample Code

#define INCL_DOSSEMAPHORES #include <os2.h> UCHAR SemName[15]; PMUX phmuxMySemaphore= NULL; /* pointer to my semaphore handle */ /* a shared MuxWiat semaphore is successfully created in another process */ /* its name happens to be \SEM32\MySem */ strcpy(SemName,"\\SEM32\\MySem"); rc = DosOpenMuxWaitSem(SemName, phmuxMySemaphore); if (rc != 0) { /* We got an error to take care of. */ }

See Also

DosAddMuxWaitSem, DosCloseMuxWaitSem, DosCreateMuxWaitSemDosDeleteMuxWaitSem, DosQueryMuxWaitSem, DosWaitMuxWaitSem

Author

Joe Phillips - jaiger@eng2.uconn.edu

Additions

Last modified July 21/1996
Please send all errors, comments, and suggestions to: timur@vnet.ibm.com

0NO_ERRORSemaphore opened successfully
6ERROR_INVALID_HANDLEError, The value in phmuxSemaphore does not point to a valid semaphore
8ERROR_NOT_ENOUGH_MEMORYError, The system memory limit has been exceeded
87ERROR_INVALID_PARAMETERError, One or more parameters is not recognized, See parameters above, Both pszSemaphoreName and phmuxSemaphore may be NULL
105ERROR_SEM_OWNER_DIEDError, The owner of the semaphore has died without freeing the semaphore
123ERROR_INVALID_NAMEError, The name pointed to by pszSemaphoreName has been rejected by the file system
187ERROR_SEM_NOT_FOUNDError, There is no semaphore with the name in pszSemaphoreName
291ERROR_TOO_MANY_OPENSError, The usage count for the semaphore in question has exceeded the system limit of 65535

The OS/2 API Project

DosOpenMuxWaitSem