DosQueryMuxWaitSem retrieves the semaphore records from a muxwait-semaphore list.

The process must have previously opened the muxwait semaphore by issuing DosCreateMuxWaitSem or DosOpenMuxWaitSem. If the muxwait semaphore does not exist, then the system returns the ERROR_INVALID_HANDLE return code to the caller.

The value that pcSemRec points to on input must be the maximum number of semaphore record entries that can be contained in the list pointed to by The value that pSemRec For example, if the list pointed to by pSemRec can contain ten semaphore record entries, then you should set the input value pointed to by pcSemRec to ten before issuing DosQueryMuxWaitSem.

If the list pointed to by pSemRec is not large enough to hold all of the semaphore records in the specified muxwait semaphore, then the system sets the value pointed to by pcSemRec to the number of semaphore records in the specified muxwait semaphore, and sets the return code to ERROR_PARAM_TOO_SMALL. This allows you to issue DosQueryMuxWaitSem again, with the correct amount of memory for the muxwait-semaphore list.

The system returns the ERROR_SEM_OWNER_DIED return code if any of the mutex semaphores in the muxwait semaphore have been placed into the owner-died state. This means that a thread ended while it owned at least one mutex semaphore, and at least one mutex semaphore is part of the muxwait semaphore. It also means that the mutex semaphore has not yet been removed by DosCloseMutexSem.

When the system returns the ERROR_SEM_OWNER_DIED return code, you should issue DosQueryMutexSem for each mutex semaphore in the muxwait-semaphore list to determine which ones are invalid. For each mutex semaphore that results in the ERROR_SEM_OWNER_DIED return code from DosQueryMutexSem, issue DosCloseMutexSem to close the mutex semaphore. Semaphore handles may be used again, so the mutex semaphores that are closed must be deleted from the muxwait semaphore.


[Back] [Next]