Sometimes we need a thread to wait until it gets a signal from another thread. This kind of signaling can be done in few ways. Explore signaling and learn about an AutoResetEvent.
- [Instructor] In order to have some kind…of synchronization while using shared resources,…we use signaling.…Signaling is used to notify another thread…that it can now access the resource that was being used…by the current thread.…We use three kinds of EventWaitHandles for signaling.…They are AutoResetEvent, ManualResetEvent,…and CountdownEvent.…AutoResetEvent is used when threads…need exclusive access to a resource,…and they communicate their intent by signaling.…
It's very similar to a ManualResetEvent,…except that it resets itself automatically.…An AutoResetEvent is like a baffle gate.…Only one person can pass through at any given point of time.…In case of an AutoResetEvent,…we can only have one thread access a resource.…It automatically closes right after someone steps through,…that's why it's called AutoResetEvent.…Closing the baffle gate is similar…to resetting the AutoResetEvent in C-Sharp.…
A thread waits for a signal by calling WaitOne…on the AutoResetEvent.…If the AutoResetEvent is in the non-signal state,…
Released
4/2/2018- Thread safety and affinity
- Signaling
- Task Parallel Library (TPL) basics
- PLINQ introduction
- Task-based Asynchronous Pattern (TAP)
Share this video
Embed this video
Video: Signaling: AutoResetEvent