Passing `val` to notify on Condition

The manual (Tasks · The Julia Language) says that notify can pass val to its waiting conditions.

How can I obtain val from the woken up conditions?

That’s the value wait will return:

julia> c = Condition()
Condition(Base.InvasiveLinkedList{Task}(nothing, nothing), Base.AlwaysLockedST(1))

julia> @async println("waited for a ", wait(c))
Task (runnable) @0x00007f8ea0ebc7f0

julia> notify(c, 222); println()

waited for a 222
1 Like