AsyncLock

A naive implementation of async lock

https://github.com/ebalynn/AsyncLock

Behind the scenes the implementation uses SemaphoreSlim to do all the heavy lifting which already has a support for async/await.

You would normally use AsyncLock within a “using” statement. To keep the implementation as simple as possible I do not use any cancellation tokens for any of the operations.

Usage:

private readonly AsyncLock _lock = new AsyncLock();
public async Task DoSomethingAsync()
{
  using (await _lock.EnterAsync())
  {
    await Task.Delay(TimeSpan.FromSeconds(1));
  }
}

Simples

Visual Studio and Git

So it happens that the company I started working for yesterday uses Git for all their source control needs. Having heard a lot of positive stuff about Git, but having no experience of actually using it,I had to dig around to find some decent integration tools that work well with Visual Studio 2013.

To my surprise, as of Visual Studio 2012.2, Microsoft already supports Git (I had to double check this and pinch myself!) There are Visual Studio Tools for Git available for download directly from Microsoft and there is quite a chunky write up Getting Started with Git in Visual Studio and Team Foundation Service

Will try it out at work today!

Blog at WordPress.com.

Up ↑