Name of pattern for locking async or multithreaded control

by Dan Monego   Last Updated September 11, 2019 00:05 AM - source

I've seen this pattern several times, both in async and multithreaded code. A counter is used to track asynchronous behavior or thread behavior - whenever a new action is started, the counter is incremented. When it's finished, the counter is decremented.

While this is happening, another process is only able to proceed if the counter is zero.

This is particularly useful as a way to handle user actions that need to be resolved before moving to another workflow.

Is there a name for this locking pattern?

Related Questions

Implementation of Asynchronous function call in C

Updated April 27, 2015 00:02 AM

Correct usage of async/await and Task.Run()

Updated May 01, 2017 13:05 PM

Need Async/Await equivalent for BackgroundWorker

Updated June 25, 2016 08:02 AM