System.Threading.Monitor.Wait C# (CSharp) Method

Wait() public static method

public static Wait ( object obj, int millisecondsTimeout, bool exitContext ) : bool
obj object
millisecondsTimeout int
exitContext bool
return bool
		public static bool Wait(object obj, int millisecondsTimeout, bool exitContext) {
			try {
				if (exitContext) SynchronizationAttribute.ExitContext ();
				return Wait (obj, millisecondsTimeout);
			}
			finally {
				if (exitContext) SynchronizationAttribute.EnterContext ();
			}
		}

Same methods

Monitor::Wait ( object obj ) : bool
Monitor::Wait ( object obj, System.TimeSpan timeout ) : bool
Monitor::Wait ( object obj, System.TimeSpan timeout, bool exitContext ) : bool
Monitor::Wait ( object obj, int millisecondsTimeout ) : bool

Usage Example

示例#1
0
        public void Invoke(Action action)
        {
            // Execute now if already on the thread
            if (Thread.CurrentThread == _thread)
            {
                action();
            }
            else
            {
                lock (action)
                {
                    // Schedule action
                    InvokeLater(action);

                    // Wait for action to complete
                    ThreadMonitor.Wait(action);
                }
            }
        }
All Usage Examples Of System.Threading.Monitor::Wait