Name of pattern for locking async or multithreaded control

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

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

Updated April 27, 2015 00:02 AM

Updated May 01, 2017 13:05 PM

Updated July 01, 2017 19:05 PM

Updated June 25, 2016 08:02 AM