Skip to content

Latest commit

 

History

History
49 lines (32 loc) · 533 Bytes

README.md

File metadata and controls

49 lines (32 loc) · 533 Bytes

Rwlock

More friendly rwlock wraps

*must use using

Rwlock

using Volight.LockWraps;

var rwl = new Rwlock();


using (_ = rwl.Read()) {
    // .. do anything
}
// auto exit lock


using (_ = rwl.Write()) {
    // .. do anything
}
// auto exit lock

Rwlock<T>

var rwl = new Rwlock<int>(0);


using (var g = rwl.Read())
{
    // .. do anything
    Console.WriteLine(g.Value);
}
// auto exit lock


using (var g = rwl.Write())
{
    // .. do anything
    g.Value = 1;
}
// auto exit lock