System.Threading.WaitHandle.WaitOne C# (CSharp) Method

WaitOne() private method

private WaitOne ( long timeout, bool exitContext ) : bool
timeout long
exitContext bool
return bool
        private bool WaitOne(long timeout, bool exitContext)
        {
            if (safeWaitHandle == null)
            {
                throw new ObjectDisposedException(null, Environment.GetResourceString("ObjectDisposed_Generic"));
            }
            int ret = WaitOneNative(safeWaitHandle,(uint)timeout,hasThreadAffinity,exitContext);
            if (ret == WAIT_ABANDONED)
            {
                throw new AbandonedMutexException();
            }
            return (ret != WaitTimeout);
        }
        

Same methods

WaitHandle::WaitOne ( ) : bool
WaitHandle::WaitOne ( TimeSpan timeout, bool exitContext ) : bool
WaitHandle::WaitOne ( int millisecondsTimeout, bool exitContext ) : bool

Usage Example

Esempio n. 1
0
        public DialogResult ShowDialog(MobileRemoteUI parentForm, WaitHandle waitResult, AddressSelector.BluetoothDevice device, BluetoothHidWriter hidWriter)
        {
            _statusLabel.Text = "Connecting...";
            _hidWriter = hidWriter;
            _waitResult = waitResult;
            if (device.Address > 0)
            {
                _existingMachine.Dock = DockStyle.Fill;
                _existingMachine.Visible = true;
                _newMachineLabel.Visible = false;
            }
            else
            {
                _newMachineLabel.Dock = DockStyle.Fill;
                _newMachineLabel.Visible = true;
                _existingMachine.Visible = false;
            }

            timer1.Enabled = true;

            if (waitResult.WaitOne(1000, false))
            {
                //return DialogResult.OK;
            }

            try
            {
                return base.ShowDialog(parentForm);
            }
            finally
            {
                timer1.Enabled = false;
            }
        }
All Usage Examples Of System.Threading.WaitHandle::WaitOne