Represents a synchronization primitive that is signaled when its count reaches zero.
More...
|
| CountdownEvent (int initialCount) |
| Initializes a new instance of T:System.Threading.CountdownEvent class with the specified count. More...
|
|
void | Dispose () |
| Releases all resources used by the current instance of the T:System.Threading.CountdownEvent class. More...
|
|
bool | Signal () |
| Registers a signal with the T:System.Threading.CountdownEvent, decrementing the value of P:System.Threading.CountdownEvent.CurrentCount. More...
|
|
bool | Signal (int signalCount) |
| Registers multiple signals with the T:System.Threading.CountdownEvent, decrementing the value of P:System.Threading.CountdownEvent.CurrentCount by the specified amount. More...
|
|
void | AddCount () |
| Increments the T:System.Threading.CountdownEvent's current count by one. More...
|
|
bool | TryAddCount () |
| Attempts to increment P:System.Threading.CountdownEvent.CurrentCount by one. More...
|
|
void | AddCount (int signalCount) |
| Increments the T:System.Threading.CountdownEvent's current count by a specified value. More...
|
|
bool | TryAddCount (int signalCount) |
| Attempts to increment P:System.Threading.CountdownEvent.CurrentCount by a specified value. More...
|
|
void | Reset () |
| Resets the P:System.Threading.CountdownEvent.CurrentCount to the value of P:System.Threading.CountdownEvent.InitialCount. More...
|
|
void | Reset (int count) |
| Resets the P:System.Threading.CountdownEvent.InitialCount property to a specified value. More...
|
|
void | Wait () |
| Blocks the current thread until the T:System.Threading.CountdownEvent is set. More...
|
|
void | Wait (CancellationToken cancellationToken) |
| Blocks the current thread until the T:System.Threading.CountdownEvent is set, while observing a T:System.Threading.CancellationToken. More...
|
|
bool | Wait (TimeSpan timeout) |
| Blocks the current thread until the T:System.Threading.CountdownEvent is set, using a T:System.TimeSpan to measure the timeout. More...
|
|
bool | Wait (TimeSpan timeout, CancellationToken cancellationToken) |
| Blocks the current thread until the T:System.Threading.CountdownEvent is set, using a T:System.TimeSpan to measure the timeout, while observing a T:System.Threading.CancellationToken. More...
|
|
bool | Wait (int millisecondsTimeout) |
| Blocks the current thread until the T:System.Threading.CountdownEvent is set, using a 32-bit signed integer to measure the timeout. More...
|
|
bool | Wait (int millisecondsTimeout, CancellationToken cancellationToken) |
| Blocks the current thread until the T:System.Threading.CountdownEvent is set, using a 32-bit signed integer to measure the timeout, while observing a T:System.Threading.CancellationToken. More...
|
|
|
virtual void | Dispose (bool disposing) |
| Releases the unmanaged resources used by the T:System.Threading.CountdownEvent, and optionally releases the managed resources. More...
|
|
|
int | CurrentCount [get] |
| Gets the number of remaining signals required to set the event. More...
|
|
int | InitialCount [get] |
| Gets the numbers of signals initially required to set the event. More...
|
|
bool | IsSet [get] |
| Indicates whether the T:System.Threading.CountdownEvent object's current count has reached zero.. More...
|
|
WaitHandle | WaitHandle [get] |
| Gets a T:System.Threading.WaitHandle that is used to wait for the event to be set. More...
|
|
Represents a synchronization primitive that is signaled when its count reaches zero.
Definition at line 12 of file CountdownEvent.cs.
◆ CountdownEvent()
System.Threading.CountdownEvent.CountdownEvent |
( |
int |
initialCount | ) |
|
Initializes a new instance of T:System.Threading.CountdownEvent class with the specified count.
- Parameters
-
initialCount | The number of signals initially required to set the T:System.Threading.CountdownEvent. |
- Exceptions
-
T:System.ArgumentOutOfRangeException | initialCount is less than 0. |
Definition at line 83 of file CountdownEvent.cs.
◆ AddCount() [1/2]
void System.Threading.CountdownEvent.AddCount |
( |
| ) |
|
Increments the T:System.Threading.CountdownEvent's current count by one.
- Exceptions
-
T:System.ObjectDisposedException | The current instance has already been disposed. |
T:System.InvalidOperationException | The current instance is already set.-or- P:System.Threading.CountdownEvent.CurrentCount is equal to or greater than F:System.Int32.MaxValue. |
Definition at line 186 of file CountdownEvent.cs.
◆ AddCount() [2/2]
void System.Threading.CountdownEvent.AddCount |
( |
int |
signalCount | ) |
|
Increments the T:System.Threading.CountdownEvent's current count by a specified value.
- Parameters
-
signalCount | The value by which to increase P:System.Threading.CountdownEvent.CurrentCount. |
- Exceptions
-
T:System.ObjectDisposedException | The current instance has already been disposed. |
T:System.ArgumentOutOfRangeException | signalCount is less than or equal to 0. |
T:System.InvalidOperationException | The current instance is already set.-or- P:System.Threading.CountdownEvent.CurrentCount is equal to or greater than F:System.Int32.MaxValue after count is incremented by signalCount. |
Definition at line 210 of file CountdownEvent.cs.
◆ Dispose() [1/2]
void System.Threading.CountdownEvent.Dispose |
( |
| ) |
|
◆ Dispose() [2/2]
virtual void System.Threading.CountdownEvent.Dispose |
( |
bool |
disposing | ) |
|
|
protectedvirtual |
Releases the unmanaged resources used by the T:System.Threading.CountdownEvent, and optionally releases the managed resources.
- Parameters
-
disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Definition at line 109 of file CountdownEvent.cs.
◆ Reset() [1/2]
void System.Threading.CountdownEvent.Reset |
( |
| ) |
|
Resets the P:System.Threading.CountdownEvent.CurrentCount to the value of P:System.Threading.CountdownEvent.InitialCount.
- Exceptions
-
T:System.ObjectDisposedException | The current instance has already been disposed.. |
Definition at line 258 of file CountdownEvent.cs.
◆ Reset() [2/2]
void System.Threading.CountdownEvent.Reset |
( |
int |
count | ) |
|
Resets the P:System.Threading.CountdownEvent.InitialCount property to a specified value.
- Parameters
-
count | The number of signals required to set the T:System.Threading.CountdownEvent. |
- Exceptions
-
T:System.ObjectDisposedException | The current instance has alread been disposed. |
T:System.ArgumentOutOfRangeException | count is less than 0. |
Definition at line 269 of file CountdownEvent.cs.
◆ Signal() [1/2]
bool System.Threading.CountdownEvent.Signal |
( |
| ) |
|
Registers a signal with the T:System.Threading.CountdownEvent, decrementing the value of P:System.Threading.CountdownEvent.CurrentCount.
- Returns
- true if the signal caused the count to reach zero and the event was set; otherwise, false.
- Exceptions
-
T:System.ObjectDisposedException | The current instance has already been disposed. |
T:System.InvalidOperationException | The current instance is already set. |
Definition at line 123 of file CountdownEvent.cs.
◆ Signal() [2/2]
bool System.Threading.CountdownEvent.Signal |
( |
int |
signalCount | ) |
|
Registers multiple signals with the T:System.Threading.CountdownEvent, decrementing the value of P:System.Threading.CountdownEvent.CurrentCount by the specified amount.
- Parameters
-
signalCount | The number of signals to register. |
- Returns
- true if the signals caused the count to reach zero and the event was set; otherwise, false.
- Exceptions
-
T:System.ObjectDisposedException | The current instance has already been disposed. |
T:System.ArgumentOutOfRangeException | signalCount is less than 1. |
T:System.InvalidOperationException | The current instance is already set. -or- Or signalCount is greater than P:System.Threading.CountdownEvent.CurrentCount. |
Definition at line 151 of file CountdownEvent.cs.
◆ TryAddCount() [1/2]
bool System.Threading.CountdownEvent.TryAddCount |
( |
| ) |
|
Attempts to increment P:System.Threading.CountdownEvent.CurrentCount by one.
- Returns
- true if the increment succeeded; otherwise, false. If P:System.Threading.CountdownEvent.CurrentCount is already at zero, this method will return false.
- Exceptions
-
T:System.ObjectDisposedException | The current instance has already been disposed. |
T:System.InvalidOperationException | P:System.Threading.CountdownEvent.CurrentCount is equal to F:System.Int32.MaxValue. |
Definition at line 197 of file CountdownEvent.cs.
◆ TryAddCount() [2/2]
bool System.Threading.CountdownEvent.TryAddCount |
( |
int |
signalCount | ) |
|
Attempts to increment P:System.Threading.CountdownEvent.CurrentCount by a specified value.
- Parameters
-
signalCount | The value by which to increase P:System.Threading.CountdownEvent.CurrentCount. |
- Returns
- true if the increment succeeded; otherwise, false. If P:System.Threading.CountdownEvent.CurrentCount is already at zero this will return false.
- Exceptions
-
T:System.ObjectDisposedException | The current instance has already been disposed. |
T:System.ArgumentOutOfRangeException | signalCount is less than or equal to 0. |
T:System.InvalidOperationException | The current instance is already set.-or- P:System.Threading.CountdownEvent.CurrentCount + signalCount is equal to or greater than F:System.Int32.MaxValue. |
Definition at line 227 of file CountdownEvent.cs.
◆ Wait() [1/6]
void System.Threading.CountdownEvent.Wait |
( |
| ) |
|
Blocks the current thread until the T:System.Threading.CountdownEvent is set.
- Exceptions
-
T:System.ObjectDisposedException | The current instance has already been disposed. |
Definition at line 291 of file CountdownEvent.cs.
◆ Wait() [2/6]
Blocks the current thread until the T:System.Threading.CountdownEvent is set, while observing a T:System.Threading.CancellationToken.
- Parameters
-
cancellationToken | The T:System.Threading.CancellationToken to observe. |
- Exceptions
-
T:System.OperationCanceledException | cancellationToken has been canceled. |
T:System.ObjectDisposedException | The current instance has already been disposed. -or- The T:System.Threading.CancellationTokenSource that created cancellationToken has already been disposed. |
Definition at line 302 of file CountdownEvent.cs.
◆ Wait() [3/6]
bool System.Threading.CountdownEvent.Wait |
( |
TimeSpan |
timeout | ) |
|
Blocks the current thread until the T:System.Threading.CountdownEvent is set, using a T:System.TimeSpan to measure the timeout.
- Parameters
-
timeout | A T:System.TimeSpan that represents the number of milliseconds to wait, or a T:System.TimeSpan that represents -1 milliseconds to wait indefinitely. |
- Returns
- true if the T:System.Threading.CountdownEvent was set; otherwise, false.
- Exceptions
-
T:System.ObjectDisposedException | The current instance has already been disposed. |
T:System.ArgumentOutOfRangeException | timeout is a negative number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater than F:System.Int32.MaxValue. |
Definition at line 314 of file CountdownEvent.cs.
◆ Wait() [4/6]
Blocks the current thread until the T:System.Threading.CountdownEvent is set, using a T:System.TimeSpan to measure the timeout, while observing a T:System.Threading.CancellationToken.
- Parameters
-
timeout | A T:System.TimeSpan that represents the number of milliseconds to wait, or a T:System.TimeSpan that represents -1 milliseconds to wait indefinitely. |
cancellationToken | The T:System.Threading.CancellationToken to observe. |
- Returns
- true if the T:System.Threading.CountdownEvent was set; otherwise, false.
- Exceptions
-
T:System.OperationCanceledException | cancellationToken has been canceled. |
T:System.ObjectDisposedException | The current instance has already been disposed. -or- The T:System.Threading.CancellationTokenSource that created cancellationToken has already been disposed. |
T:System.ArgumentOutOfRangeException | timeout is a negative number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater than F:System.Int32.MaxValue. |
Definition at line 334 of file CountdownEvent.cs.
◆ Wait() [5/6]
bool System.Threading.CountdownEvent.Wait |
( |
int |
millisecondsTimeout | ) |
|
Blocks the current thread until the T:System.Threading.CountdownEvent is set, using a 32-bit signed integer to measure the timeout.
- Parameters
-
millisecondsTimeout | The number of milliseconds to wait, or F:System.Threading.Timeout.Infinite(-1) to wait indefinitely. |
- Returns
- true if the T:System.Threading.CountdownEvent was set; otherwise, false.
- Exceptions
-
T:System.ObjectDisposedException | The current instance has already been disposed. |
T:System.ArgumentOutOfRangeException | millisecondsTimeout is a negative number other than -1, which represents an infinite time-out. |
Definition at line 351 of file CountdownEvent.cs.
◆ Wait() [6/6]
bool System.Threading.CountdownEvent.Wait |
( |
int |
millisecondsTimeout, |
|
|
CancellationToken |
cancellationToken |
|
) |
| |
Blocks the current thread until the T:System.Threading.CountdownEvent is set, using a 32-bit signed integer to measure the timeout, while observing a T:System.Threading.CancellationToken.
- Parameters
-
millisecondsTimeout | The number of milliseconds to wait, or F:System.Threading.Timeout.Infinite(-1) to wait indefinitely. |
cancellationToken | The T:System.Threading.CancellationToken to observe. |
- Returns
- true if the T:System.Threading.CountdownEvent was set; otherwise, false.
- Exceptions
-
T:System.OperationCanceledException | cancellationToken has been canceled. |
T:System.ObjectDisposedException | The current instance has already been disposed. -or- The T:System.Threading.CancellationTokenSource that created cancellationToken has already been disposed. |
T:System.ArgumentOutOfRangeException | millisecondsTimeout is a negative number other than -1, which represents an infinite time-out. |
Definition at line 366 of file CountdownEvent.cs.
◆ CurrentCount
int System.Threading.CountdownEvent.CurrentCount |
|
get |
Gets the number of remaining signals required to set the event.
- Returns
- The number of remaining signals required to set the event.
Definition at line 26 of file CountdownEvent.cs.
◆ InitialCount
int System.Threading.CountdownEvent.InitialCount |
|
get |
Gets the numbers of signals initially required to set the event.
- Returns
- The number of signals initially required to set the event.
Definition at line 43 of file CountdownEvent.cs.
◆ IsSet
bool System.Threading.CountdownEvent.IsSet |
|
get |
Indicates whether the T:System.Threading.CountdownEvent object's current count has reached zero..
- Returns
true
if the current count is zero; otherwise, false
.
Definition at line 56 of file CountdownEvent.cs.
◆ WaitHandle
WaitHandle System.Threading.CountdownEvent.WaitHandle |
|
get |
Gets a T:System.Threading.WaitHandle that is used to wait for the event to be set.
- Returns
- A T:System.Threading.WaitHandle that is used to wait for the event to be set.
- Exceptions
-
T:System.ObjectDisposedException | The current instance has already been disposed. |
Definition at line 69 of file CountdownEvent.cs.
The documentation for this class was generated from the following file: