Skip to content

Commit 31459d3

Browse files
pkulikovRon Petrusha
authored and
Ron Petrusha
committed
Revised AutoResetEvent remarks (#1728)
* Revised AutoResetEvent remarks * Update xml/System.Threading/AutoResetEvent.xml Co-Authored-By: pkulikov <[email protected]>
1 parent beb5580 commit 31459d3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

xml/System.Threading/AutoResetEvent.xml

+8-8
Original file line numberDiff line numberDiff line change
@@ -34,30 +34,28 @@
3434
</Attribute>
3535
</Attributes>
3636
<Docs>
37-
<summary>Notifies a waiting thread that an event has occurred. This class cannot be inherited.</summary>
37+
<summary>Represents a thread synchronization event that, when signaled, resets automatically after releasing a single waiting thread. This class cannot be inherited.</summary>
3838
<remarks>
3939
<format type="text/markdown"><![CDATA[
4040
4141
## Remarks
42-
`AutoResetEvent` allows threads to communicate with each other by signaling. Typically, you use this class when threads need exclusive access to a resource.
42+
You use `AutoResetEvent`, <xref:System.Threading.ManualResetEvent>, and <xref:System.Threading.EventWaitHandle> for thread interaction (or thread signaling). For more information, see the [Thread interaction, or signaling](~/docs/standard/threading/overview-of-synchronization-primitives.md#thread-interaction-or-signaling) section of the [Overview of synchronization primitives](~/docs/standard/threading/overview-of-synchronization-primitives.md) article.
4343
4444
> [!IMPORTANT]
4545
> This type implements the <xref:System.IDisposable> interface. When you have finished using the type, you should dispose of it either directly or indirectly. To dispose of the type directly, call its <xref:System.IDisposable.Dispose%2A> method in a `try`/`catch` block. To dispose of it indirectly, use a language construct such as `using` (in C#) or `Using` (in Visual Basic). For more information, see the "Using an Object that Implements IDisposable" section in the <xref:System.IDisposable> interface topic.
4646
47-
A thread waits for a signal by calling <xref:System.Threading.WaitHandle.WaitOne%2A> on the `AutoResetEvent`. If the `AutoResetEvent` is in the non-signaled state, the thread blocks, waiting for the thread that currently controls the resource to signal that the resource is available by calling <xref:System.Threading.EventWaitHandle.Set%2A>.
47+
A thread waits for a signal by calling [AutoResetEvent.WaitOne](xref:System.Threading.WaitHandle.WaitOne%2A). If the `AutoResetEvent` is in the non-signaled state, the thread blocks until [AutoResetEvent.Set](xref:System.Threading.EventWaitHandle.Set%2A) is called.
4848
4949
Calling `Set` signals `AutoResetEvent` to release a waiting thread. `AutoResetEvent` remains signaled until a single waiting thread is released, and then automatically returns to the non-signaled state. If no threads are waiting, the state remains signaled indefinitely.
5050
5151
If a thread calls <xref:System.Threading.WaitHandle.WaitOne%2A> while the <xref:System.Threading.AutoResetEvent> is in the signaled state, the thread does not block. The <xref:System.Threading.AutoResetEvent> releases the thread immediately and returns to the non-signaled state.
5252
5353
> [!IMPORTANT]
54-
> There is no guarantee that every call to the <xref:System.Threading.EventWaitHandle.Set%2A> method will release a thread. If two calls are too close together, so that the second call occurs before a thread has been released, only one thread is released. It is as if the second call did not happen. Also, if <xref:System.Threading.EventWaitHandle.Set%2A> is called when there are no threads waiting and the <xref:System.Threading.AutoResetEvent> is already signaled, the call has no effect.
54+
> There is no guarantee that every call to the <xref:System.Threading.EventWaitHandle.Set%2A> method will release a thread. If two calls are too close together, so that the second call occurs before a thread has been released, only one thread is released. It's as if the second call did not happen. Also, if <xref:System.Threading.EventWaitHandle.Set%2A> is called when there are no threads waiting and the <xref:System.Threading.AutoResetEvent> is already signaled, the call has no effect.
5555
5656
You can control the initial state of an `AutoResetEvent` by passing a Boolean value to the constructor: `true` if the initial state is signaled and `false` otherwise.
5757
58-
`AutoResetEvent` can also be used with the `static`<xref:System.Threading.WaitHandle.WaitAll%2A> and <xref:System.Threading.WaitHandle.WaitAny%2A> methods.
59-
60-
For more information about thread synchronization mechanisms, see [AutoResetEvent](~/docs/standard/threading/autoresetevent.md) in the conceptual documentation.
58+
`AutoResetEvent` can also be used with the `static` <xref:System.Threading.WaitHandle.WaitAll%2A> and <xref:System.Threading.WaitHandle.WaitAny%2A> methods.
6159
6260
Beginning with the .NET Framework version 2.0, <xref:System.Threading.AutoResetEvent> derives from the new <xref:System.Threading.EventWaitHandle> class. An <xref:System.Threading.AutoResetEvent> is functionally equivalent to an <xref:System.Threading.EventWaitHandle> created with <xref:System.Threading.EventResetMode.AutoReset?displayProperty=nameWithType>.
6361
@@ -80,6 +78,7 @@
8078
<threadsafe>This class is thread safe.</threadsafe>
8179
<altmember cref="T:System.Threading.WaitHandle" />
8280
<related type="Article" href="~/docs/standard/threading/index.md">Managed Threading</related>
81+
<related type="Article" href="~/docs/standard/threading/overview-of-synchronization-primitives.md">Overview of synchronization primitives</related>
8382
</Docs>
8483
<Members>
8584
<Member MemberName=".ctor">
@@ -140,6 +139,7 @@
140139
</remarks>
141140
<altmember cref="T:System.Threading.WaitHandle" />
142141
<related type="Article" href="~/docs/standard/threading/index.md">Managed Threading</related>
142+
<related type="Article" href="~/docs/standard/threading/overview-of-synchronization-primitives.md">Overview of synchronization primitives</related>
143143
</Docs>
144144
</Member>
145145
<Member MemberName="Reset">
@@ -211,4 +211,4 @@ The Set method releases a single thread. If there are no waiting threads, the wa
211211
</Docs>
212212
</Member>
213213
</Members>
214-
</Type>
214+
</Type>

0 commit comments

Comments
 (0)