public async Task <string> AcquireWriterLockAsync(string name) { CustomReaderWriterLock crwl; lock (this) { if (_rwls.ContainsKey(name)) { crwl = _rwls[name]; } else { crwl = new CustomReaderWriterLock(); _rwls[name] = crwl; } } return(await crwl.AcquireWriterLockAsync()); }
public string AcquireWriterLock(string name) { CustomReaderWriterLock crwl; lock (this) { if (_rwls.ContainsKey(name)) { crwl = _rwls[name]; } else { crwl = new CustomReaderWriterLock(); _rwls[name] = crwl; } } return(crwl.AcquireWriterLock()); }