private int ProcessSignaledWaitState(WaitHandle[] waitHandlesForAbandon, out Exception exception)
            {
                s_lock.VerifyIsNotLocked();
                _waitMonitor.VerifyIsLocked();
                Debug.Assert(_thread == RuntimeThread.CurrentThread);

                switch (_waitSignalState)
                {
                case WaitSignalState.Waiting:
                    exception = null;
                    return(WaitHandle.WaitTimeout);

                case WaitSignalState.Waiting_SignaledToSatisfyWait:
                {
                    Debug.Assert(_waitedObjectIndexThatSatisfiedWait >= 0);
                    int waitedObjectIndexThatSatisfiedWait = _waitedObjectIndexThatSatisfiedWait;
                    _waitedObjectIndexThatSatisfiedWait = -1;
                    exception = null;
                    return(waitedObjectIndexThatSatisfiedWait);
                }

                case WaitSignalState.Waiting_SignaledToSatisfyWaitWithAbandonedMutex:
                    Debug.Assert(_waitedObjectIndexThatSatisfiedWait >= 0);
                    if (waitHandlesForAbandon == null)
                    {
                        _waitedObjectIndexThatSatisfiedWait = -1;
                        exception = new AbandonedMutexException();
                    }
                    else
                    {
                        int waitedObjectIndexThatSatisfiedWait = _waitedObjectIndexThatSatisfiedWait;
                        _waitedObjectIndexThatSatisfiedWait = -1;
                        exception =
                            new AbandonedMutexException(
                                waitedObjectIndexThatSatisfiedWait,
                                waitHandlesForAbandon[waitedObjectIndexThatSatisfiedWait]);
                    }
                    return(0);

                case WaitSignalState.Waiting_SignaledToAbortWaitDueToMaximumMutexReacquireCount:
                    Debug.Assert(_waitedObjectIndexThatSatisfiedWait < 0);
                    exception = new OverflowException(SR.Overflow_MutexReacquireCount);
                    return(0);

                default:
                    Debug.Assert(_waitSignalState == WaitSignalState.Waiting_SignaledToInterruptWait);
                    Debug.Assert(_waitedObjectIndexThatSatisfiedWait < 0);
                    exception = new ThreadInterruptedException();
                    return(0);
                }
            }