Skip to content

Commit 8f7551f

Browse files
pkulikovRon Petrusha
authored andcommitted
Revised ManualResetEvent remarks (dotnet#1739)
* Revised ManualResetEvent remarks * Updated links * Apply suggestions from code review Co-Authored-By: pkulikov <[email protected]> * Addressed feedback * Typo fix
1 parent 389bd16 commit 8f7551f

File tree

2 files changed

+44
-43
lines changed

2 files changed

+44
-43
lines changed

xml/System.Threading/ManualResetEvent.xml

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,29 @@
3434
</Attribute>
3535
</Attributes>
3636
<Docs>
37-
<summary>Notifies one or more waiting threads that an event has occurred. This class cannot be inherited.</summary>
37+
<summary>Represents a thread synchronization event that, when signaled, must be reset manually. This class cannot be inherited.</summary>
3838
<remarks>
3939
<format type="text/markdown"><![CDATA[
4040
4141
## Remarks
42-
In the .NET Framework version 2.0, <xref:System.Threading.ManualResetEvent> derives from the new <xref:System.Threading.EventWaitHandle> class. A <xref:System.Threading.ManualResetEvent> is functionally equivalent to an <xref:System.Threading.EventWaitHandle> created with <xref:System.Threading.EventResetMode.ManualReset?displayProperty=nameWithType>.
43-
44-
> [!NOTE]
45-
> Unlike the <xref:System.Threading.ManualResetEvent> class, the <xref:System.Threading.EventWaitHandle> class provides access to named system synchronization events.
46-
47-
<xref:System.Threading.ManualResetEvent> allows threads to communicate with each other by signaling. Typically, this communication concerns a task which one thread must complete before other threads can proceed.
48-
49-
When a thread begins an activity that must complete before other threads proceed, it calls <xref:System.Threading.EventWaitHandle.Reset%2A> to put `ManualResetEvent` in the non-signaled state. This thread can be thought of as controlling the `ManualResetEvent`. Threads that call <xref:System.Threading.WaitHandle.WaitOne%2A> on the `ManualResetEvent` will block, awaiting the signal. When the controlling thread completes the activity, it calls <xref:System.Threading.EventWaitHandle.Set%2A> to signal that the waiting threads can proceed. All waiting threads are released.
50-
51-
Once it has been signaled, `ManualResetEvent` remains signaled until it is manually reset. That is, calls to `WaitOne` return immediately.
52-
53-
You can control the initial state of a `ManualResetEvent` by passing a Boolean value to the constructor, `true` if the initial state is signaled and `false` otherwise.
54-
55-
`ManualResetEvent` can also be used with the `static`<xref:System.Threading.WaitHandle.WaitAll%2A> and <xref:System.Threading.WaitHandle.WaitAny%2A> methods.
42+
43+
You use `ManualResetEvent`, <xref:System.Threading.AutoResetEvent>, 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.
44+
45+
When a thread begins an activity that must complete before other threads proceed, it calls [ManualResetEvent.Reset](xref:System.Threading.EventWaitHandle.Reset%2A) to put `ManualResetEvent` in the non-signaled state. This thread can be thought of as controlling the `ManualResetEvent`. Threads that call [ManualResetEvent.WaitOne](xref:System.Threading.WaitHandle.WaitOne%2A) block, awaiting the signal. When the controlling thread completes the activity, it calls [ManualResetEvent.Set](xref:System.Threading.EventWaitHandle.Set%2A) to signal that the waiting threads can proceed. All waiting threads are released.
46+
47+
Once it has been signaled, `ManualResetEvent` remains signaled until it is manually reset by calling the <xref:System.Threading.EventWaitHandle.Reset> method. That is, calls to <xref:System.Threading.WaitHandle.WaitOne%2A> return immediately.
48+
49+
You can control the initial state of a `ManualResetEvent` by passing a Boolean value to the constructor: `true` if the initial state is signaled, and `false` otherwise.
50+
51+
`ManualResetEvent` can also be used with the `static` <xref:System.Threading.WaitHandle.WaitAll%2A> and <xref:System.Threading.WaitHandle.WaitAny%2A> methods.
5652
57-
For more information about thread synchronization mechanisms, see [ManualResetEvent and ManualResetEventSlim](~/docs/standard/threading/manualresetevent-and-manualreseteventslim.md) in the conceptual documentation.
53+
Beginning with the .NET Framework version 2.0, <xref:System.Threading.ManualResetEvent> derives from the <xref:System.Threading.EventWaitHandle> class. A <xref:System.Threading.ManualResetEvent> is functionally equivalent to an <xref:System.Threading.EventWaitHandle> created with <xref:System.Threading.EventResetMode.ManualReset?displayProperty=nameWithType>.
5854
55+
> [!NOTE]
56+
> Unlike the <xref:System.Threading.ManualResetEvent> class, the <xref:System.Threading.EventWaitHandle> class provides access to named system synchronization events.
57+
58+
Beginning with the .NET Framework version 4.0, the <xref:System.Threading.ManualResetEventSlim?displayProperty=nameWithType> class is a lightweight alternative to <xref:System.Threading.ManualResetEvent>.
59+
5960
6061
6162
## Examples
@@ -74,7 +75,7 @@
7475
<threadsafe>This class is thread safe.</threadsafe>
7576
<altmember cref="T:System.Threading.WaitHandle" />
7677
<related type="Article" href="~/docs/standard/threading/index.md">Managed Threading</related>
77-
<related type="Article" href="~/docs/standard/threading/manualresetevent-and-manualreseteventslim.md">Manual Reset Event</related>
78+
<related type="Article" href="~/docs/standard/threading/overview-of-synchronization-primitives.md">Overview of synchronization primitives</related>
7879
</Docs>
7980
<Members>
8081
<Member MemberName=".ctor">
@@ -125,7 +126,7 @@
125126
</remarks>
126127
<altmember cref="T:System.Threading.WaitHandle" />
127128
<related type="Article" href="~/docs/standard/threading/index.md">Managed Threading</related>
128-
<related type="Article" href="~/docs/standard/threading/manualresetevent-and-manualreseteventslim.md">ManualResetEvent</related>
129+
<related type="Article" href="~/docs/standard/threading/overview-of-synchronization-primitives.md">Overview of synchronization primitives</related>
129130
</Docs>
130131
</Member>
131132
<Member MemberName="Reset">
@@ -194,4 +195,4 @@ Calling the Set method leaves the wait handle in a signaled state until the <xre
194195
</Docs>
195196
</Member>
196197
</Members>
197-
</Type>
198+
</Type>

0 commit comments

Comments
 (0)