DosOpenSem
Bindings: C, MASM
This call opens an existing system semaphore that has been created by
another process.
DosOpenSem (SemHandle, SemName)
SemHandle (PHSEM) - output
Address of the handle of the system semaphore created by DosCreateSem.
This handle must be supplied by any requests directed to the same
semaphore.
SemName (PSZ) - input
Address of the name of the system semaphore created by using
DosCreateSem.
rc (USHORT) - return
Return code descriptions are:
0 NO_ERROR
100 ERROR_TOO_MANY_SEMAPHORES
106 ERROR_SEM_USER_LIMIT
123 ERROR_INVALID_NAME
187 ERROR_SEM_NOT_FOUND
Remarks
A system semaphore that is created by a call to DosCreateSem with
NoExclusive=1 specified returns a handle, which the creating process uses
to access the semaphore. Another process that needs to access the
semaphore must call DosOpenSem after the semaphore's creation. DosOpenSem
merely returns the handle of the semaphore; it does not test or change
the value of the semaphore.
If a process has access to any semaphores at the time it issues
DosExecPgm to start a child process, the new process inherits the handles
to these semaphores. However, the new process initially does not own any
inherited semaphores, even if the parent process owns them at the time
the child process is started. Semaphore ownership is obtained by a
successful DosSemRequest call, and only one process can own the semaphore
at a time.
When the last process that opened a particular semaphore with a
DosCreateSem or DosOpenSem request closes its handle with a DosCloseSem
request, the semaphore is deleted from memory and must be be redefined by
its next user with a call to DosCreateSem.
Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs