timcassell / ProtoPromise

Robust and efficient library for management of asynchronous operations in C#/.Net.
MIT License
147 stars 13 forks source link

Use spin lock in async synchronization primitives #281

Closed timcassell closed 6 months ago

timcassell commented 11 months ago

Currently, async synchronization primitives (AsyncLock, AsyncManualResetEvent, etc) use full locks (Monitor.Enter/Exit). I think we can be a little more efficient with spin lock instead. This should especially help AsyncReaderWriterLock for multiple readers.