Lock in multithreading

I have a Condition:

l = Condition()

I need to print something whenever I notify(l), there is discriptive codes (can not run):

Threads.@spawn begin
    for i = 1 : 100
        lock(l) do
            println(i, "done")
        end
    end
end

So, when

notify(l)
1done

notify(l)
2done

notify(l)
3done

What should I do?

wait(l)
https://docs.julialang.org/en/v1/base/parallel/#Base.Threads.Condition

1 Like