Semaphore

In reply to timag:

Because tasks can potentially consume time (block/suspend), whereas functions cannot. The get() method of a semaphore is a task that can potentially block waiting for a key.

You could use the function try_get() instead. However, you cannot really have two functions running in parallel because they both consume 0 time. One will execute before the other.