Demo for synchronization primitives used in sync or async code
I m using multiple synchronization primitives in order to protect access to shared resource :
- lock (
example 1
)- monitor (
example 2,3
)- mutex (
example 4
)- semaphore (
example 5
)- semaphore slim (
example 6
)- spin lock (
example 7
)- reader writer lock (
example 8
)- reader writer lock slim (
example 9
)- semaphore slim async (
example 10
)- async monitor (
example 11
)- async lock (
example 12
)- async semaphore (
example 13
)- async reader writer lock (
example 14
)
Tools
: vs19, net core 3.1