https://github.com/volight/rwlock
More friendly rwlock wraps
https://github.com/volight/rwlock
Last synced: about 1 year ago
JSON representation
More friendly rwlock wraps
- Host: GitHub
- URL: https://github.com/volight/rwlock
- Owner: volight
- License: mit
- Created: 2022-06-20T14:30:18.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-12-15T02:20:16.000Z (over 2 years ago)
- Last Synced: 2025-02-14T07:51:26.152Z (over 1 year ago)
- Language: C#
- Homepage: https://www.nuget.org/packages/Volight.LockWraps.Rwlock
- Size: 11.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Rwlock
More friendly rwlock wraps
**\*must use using**
### Rwlock
```csharp
using Volight.LockWraps;
var rwl = new Rwlock();
using (_ = rwl.Read()) {
// .. do anything
}
// auto exit lock
using (_ = rwl.Write()) {
// .. do anything
}
// auto exit lock
```
### Rwlock\
```csharp
var rwl = new Rwlock(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
```