Waiting on a Remote Condition

I’m hoping to use Conditions to synchronise communication between a master and worker process.

The notify function will wake up only the tasks that are already waiting on a condition. If we do not know which of the following remote calls will occur first, it is possible for the following code to not terminate.

using Distributed
addprocs(1)
@fetchfrom 2 begin
    global condition = Condition()
end

@sync begin
    @async remotecall_wait(2) do
        notify(condition)
    end
    @async remotecall_wait(2) do
        wait(condition)
    end
end

From my understanding, termination is guaranteed where instead we use:

@sync begin
    @async begin
        yield()
        remotecall_wait(2) do
            notify(condition)
        end
    end
    @async remotecall_wait(2) do
        wait(condition)
    end
end

In the more general case where these remote calls occur at entirely different times to one another, termination should still be reached (with matching invocations of notify and wait), even if the notify call occurs and yields before the wait call is even initiated.

Should I be using a different tool to Conditions for this use case?
Thanks