Skip to content

Commit

Permalink
Create README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
benbarth authored Nov 8, 2017
1 parent 57af627 commit f2105a6
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# wait
An obsessively simple and performant library for protecting critical sections.

[![NuGet](https://img.shields.io/nuget/dt/wait.svg)](https://www.nuget.org/packages/wait/)


Let's look at some examples! Wait can be used using `Wait.On()` or `Wait.GetWaiter()`.

#### Wait.On()
```
Wait.On("critical section", () =>
{
// Critical Section
// Only one "critical section" will run at a time
});
new Thread(() =>
{
Wait.On("critical section", () =>
{
// Critical Section
// Only one "critical section" will run at a time
});
}).Start();
```

#### Wait.GetWaiter()
```
Waiter waiter = Wait.GetWaiter();
new Thread(() =>
{
// Downloading
waiter.Done();
}).Start();
waiter.WaitUntilDone();
// Download is done
```

0 comments on commit f2105a6

Please sign in to comment.