Difference between revisions of "DosAddMuxWaitSem"
From EDM2
(Created page with "=== Syntax === rc = DosAddMuxWaitSem( ''hmuxSemaphore'', ''pSemRecord'' ); === Parameters === HMUX ''hmuxSemaphore'' (input) The handle of the Mux...") |
m |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | DosAddMuxWaitSem adds an event semaphore or a mutex semaphore a MuxWait semaphore list. | |
− | + | ||
− | + | ||
− | + | ||
+ | == Syntax == | ||
+ | DosAddMuxWaitSem( ''hmuxSemaphore'', ''pSemRecord'' ) | ||
=== Parameters === | === Parameters === | ||
− | + | ;HMUX ''hmuxSemaphore'' (input):The handle of the MuxWait semaphore to which another semaphore will be added. | |
− | The handle of the MuxWait semaphore to which another semaphore will be added. | + | ;PSEMRECORD ''pSemRecord'' (input):The address of a SEMRECORD to be added to the specified MuxWait semaphore. |
− | + | ||
− | + | ||
− | The address of a SEMRECORD to be added to the specified MuxWait semaphore. | + | |
− | + | ||
=== Returns === | === Returns === | ||
− | + | APIRET rc | |
− | The following values can be returned | + | The following values can be returned: |
− | + | *0 NO_ERROR - Operation was successful. | |
− | + | *6 ERROR_INVALID_HANDLE - Error, The value in ''hmuxSemaphore'' does not point to a valid semaphore, The calling process must first have access to the semaphore in question | |
− | + | *8 ERROR_NOT_ENOUGH_MEMORY - Error, The system memory limit has been exhausted | |
− | + | *87 ERROR_INVALID_PARAMETER - Error, One or more of the parameters contains an illegal value. | |
− | + | *100 ERROR_TOO_MANY_SEMAPHORES - Error, The system limit of 64 semaphores has been exceeded for this MuxWait semaphore. | |
− | + | *105 ERROR_SEM_OWNER_DIED - Error, The owner of the MuxWait semaphore specified has terminated. | |
− | successful. | + | *284 ERROR_DUPLICATE_HANDLE - Error, The semaphore referred to in ''pSemRecord'' has already been added to the specified MuxWait semaphore. |
− | + | *292 ERROR_WRONG_TYPE - Error, The semaphore referred to in ''pSemRecord'' is of a different | |
− | + | ||
− | + | ||
− | + | ||
− | semaphore, The calling process must first have access to the semaphore in | + | |
− | question | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | MuxWait semaphore. | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | terminated. | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | added to the specified MuxWait semaphore. | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
type than those already in the list for ''hmuxSemaphore''. | type than those already in the list for ''hmuxSemaphore''. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=== Gotchas === | === Gotchas === | ||
− | + | All processes that have access to a shared MuxWait semaphore must also have access to the event/mutex semaphore that is to be added to the MuxWait list. | |
− | All processes that have access to a shared MuxWait semaphore must also have | + | If a process does not have access to this semaphore then it will unblock and return the error ERROR_INVALID_HANDLE. DosAddMuxWaitSem will NOT return an error in this case. The processes wishing to gain access to the MuxWait semaphore will return errors until proper access has been obtained. |
− | access to the event/mutex semaphore that is to be added to the MuxWait list. | + | |
− | If a process does not have access to this semaphore then it will unblock and | + | |
− | return the error ERROR_INVALID_HANDLE. | + | |
− | error in this case. | + | |
− | semaphore will return errors until proper access has been obtained. | + | |
=== Sample Code === | === Sample Code === | ||
− | |||
<PRE> | <PRE> | ||
#define INCL_DOSSEMAPHORES | #define INCL_DOSSEMAPHORES | ||
− | #include | + | #include <os2.h> |
HMUX hmuxMySemaphore; /* MySemaphore handle */ | HMUX hmuxMySemaphore; /* MySemaphore handle */ | ||
Line 105: | Line 49: | ||
} | } | ||
</PRE> | </PRE> | ||
+ | |||
=== See Also === | === See Also === | ||
− | [[ | + | *[[DosCloseMuxWaitSem]] |
+ | *[[DosCreateMuxWaitSem]] | ||
+ | *[[DosDeleteMuxWaitSem]] | ||
+ | *[[DosOpenMuxWaitSem]] | ||
+ | *[[DosQueryMuxWaitSem]] | ||
+ | *[[DosWaitMuxWaitSem]] | ||
− | [[Category: | + | [[Category:Dos]] |
Latest revision as of 21:47, 27 November 2019
DosAddMuxWaitSem adds an event semaphore or a mutex semaphore a MuxWait semaphore list.
Syntax
DosAddMuxWaitSem( hmuxSemaphore, pSemRecord )
Parameters
- HMUX hmuxSemaphore (input)
- The handle of the MuxWait semaphore to which another semaphore will be added.
- PSEMRECORD pSemRecord (input)
- The address of a SEMRECORD to be added to the specified MuxWait semaphore.
Returns
APIRET rc
The following values can be returned:
- 0 NO_ERROR - Operation was successful.
- 6 ERROR_INVALID_HANDLE - Error, The value in hmuxSemaphore does not point to a valid semaphore, The calling process must first have access to the semaphore in question
- 8 ERROR_NOT_ENOUGH_MEMORY - Error, The system memory limit has been exhausted
- 87 ERROR_INVALID_PARAMETER - Error, One or more of the parameters contains an illegal value.
- 100 ERROR_TOO_MANY_SEMAPHORES - Error, The system limit of 64 semaphores has been exceeded for this MuxWait semaphore.
- 105 ERROR_SEM_OWNER_DIED - Error, The owner of the MuxWait semaphore specified has terminated.
- 284 ERROR_DUPLICATE_HANDLE - Error, The semaphore referred to in pSemRecord has already been added to the specified MuxWait semaphore.
- 292 ERROR_WRONG_TYPE - Error, The semaphore referred to in pSemRecord is of a different
type than those already in the list for hmuxSemaphore.
Gotchas
All processes that have access to a shared MuxWait semaphore must also have access to the event/mutex semaphore that is to be added to the MuxWait list. If a process does not have access to this semaphore then it will unblock and return the error ERROR_INVALID_HANDLE. DosAddMuxWaitSem will NOT return an error in this case. The processes wishing to gain access to the MuxWait semaphore will return errors until proper access has been obtained.
Sample Code
#define INCL_DOSSEMAPHORES #include <os2.h> HMUX hmuxMySemaphore; /* MySemaphore handle */ SEMRECORD SemRecord; /* Record containing info about the sem */ /* I want to add to MySemaphore's list */ /* access is gained to the semaphore in question */ /* either by DosCreateMuxWaitSem ... */ /* ... or by DosOpenMuxWaitSem */ /* its handle is placed in hmuxMySemaphore */ /* SemRecord is filled with appropriate information about */ /* the semaphore I wish to add to hmuxMySemaphore's list */ rc = DosAddMuxWaitSem(hmuxMySemaphore, &SemRecord); if (rc != 0) { /* We got an error to take care of. */ }