Skip to content

Commit

Permalink
Add example tag to WaitEventFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
jpalcala committed Mar 12, 2018
1 parent 6a93420 commit eb50131
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions src/Unosquare.Swan.Lite/Components/WaitEventFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,55 @@ namespace Unosquare.Swan.Components
/// <summary>
/// Provides a Manual Reset Event factory with a unified API
/// </summary>
/// <example>
/// This example shows how to use the WaitEventFactory class

This comment has been minimized.

Copy link
@geoperez

geoperez Mar 12, 2018

Member

"The following example..."

/// <code>
/// namespace Examples.WaitEventFactory.Example

This comment has been minimized.

Copy link
@geoperez

geoperez Mar 12, 2018

Member

Remove the Namespace

/// {
/// using Unosquare.Swan.Components;
///
/// public class WaitEventFactoryExample
/// {
/// // create a WaitEvent using the slim version
/// private static readonly IWaitEvent waitEvent = WaitEventFactory.CreateSlim(false);
///
/// public static void Main()
/// {
/// Task.Factory.StartNew(() =>
/// {
/// DoWork(1);
/// });
///
/// Task.Factory.StartNew(() =>
/// {
/// DoWork(2);
/// });
///
/// // send first signal
/// waitEvent.Complete();
/// waitEvent.Begin();
///
/// Thread.Sleep(TimeSpan.FromSeconds(2));
///
/// // send second signal
/// waitEvent.Complete();
///
/// Console.Readline();
/// }
///
/// public static void DoWork(int taskNumber)
/// {
/// $"Data retrieved:{taskNumber}".WriteLine();
/// waitEvent.Wait();
///
/// Thread.Sleep(TimeSpan.FromSeconds(2));
/// $"All finished up {taskNumber}".WriteLine();
/// }
/// }
///
/// }
/// </code>
/// </example>
public static class WaitEventFactory
{
#region Factory Methods
Expand Down

0 comments on commit eb50131

Please sign in to comment.