This project is read-only.

Project Description

Helper class for locking accross one or several await calls. Based on code developed and described by Stephen Toub, http://blogs.msdn.com/b/pfxteam/archive/2012

Enough Software
An Enough Software project.

Usage

AsyncLock helps you to synchronized access easily:

private static Enough.Async.AsyncLock _asyncLock = new Enough.Async.AsyncLock();

public async Task<MyDataClass> GetDataAsyncAsync()
{
  using (await _asyncLock.LockAsync())
  {
    MyDataClass data = await LoadFromStorage();
    if (data == null)
    {
       data = await LoadFromWeb();
       await StoreData(data);
     }
     return data;
  }
}

For more information please refer to the documentation.

NuGet

Enough.AsyncLock is available on NuGet.



Last edited Oct 17, 2013 at 8:10 PM by enoughrob, version 7