Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
WaitHandle Class
WaitOne Method

  Switch on low bandwidth view
Members FilterMembers Filter
Frameworks FilterFrameworks Filter
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
WaitHandle..::.WaitOne Method

Updated: July 2008

Blocks the current thread until the current WaitHandle receives a signal.

  NameDescription
Public methodSupported by the .NET Compact FrameworkSupported by the XNA FrameworkWaitOne()()()Blocks the current thread until the current WaitHandle receives a signal.
Public methodWaitOne(Int32)Blocks the current thread until the current WaitHandle receives a signal, using a 32-bit signed integer to measure the time interval.
Public methodWaitOne(TimeSpan)Blocks the current thread until the current instance receives a signal, using a TimeSpan to measure the time interval.
Public methodSupported by the .NET Compact FrameworkSupported by the XNA FrameworkWaitOne(Int32, Boolean)Blocks the current thread until the current WaitHandle receives a signal, using a 32-bit signed integer to measure the time interval and specifying whether to exit the synchronization domain before the wait.
Public methodWaitOne(TimeSpan, Boolean)Blocks the current thread until the current instance receives a signal, using a TimeSpan to measure the time interval and specifying whether to exit the synchronization domain before the wait.
Top

Date

History

Reason

July 2008

Added new overloads: WaitOne(Int32) and WaitOne(TimeSpan).

SP1 feature change.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
WaitOne can wait less than expected      Remi Thomas   |   Edit   |   Show History
When using WaitOne with a timeout (Int32 or TimeSpan), the method can exit before the expected time.

The smallest time element is a tick. A tick is not always a second multiple. Internally WaitOne convert the timeout in tick and round it under.

On very fast machine you can exit before expected time (some micro second before + very fast machine = expected time is not correct).

RE: WaitOne can wait less than expected??      Min-Yu Yang   |   Edit   |   Show History
Remi, the paramter for WaitOne(Int32) is clearly documented as milliseconds. I wonder if you have any evidence that it's tick count instead?

Here is WaitOne(Int32)'s documented signature in C#:

public virtual bool WaitOne(
int millisecondsTimeout
)
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker