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?