I am trying to follow along with one of the examples in the documentation of the library and in the code sample below I have the problem that the function silently “vanishes” at the line
val = @yield ... and the simulation runs and “completes” in a misguided sense of the word. The
println is just there fore debugging reasons.
I suspected that it might be the use of
| that causes the problem, but that gets used in the test examples of the SimJulia package and these tests pass fine, so I don’t think it is that. I might be wrong and any help would be appreciated.
@resumable function client(sim::Simulation, teller::Resource, i::Int, priority::Int, time_in_bank::Float64) arrive = now(sim) @info "$(now(sim)), client $i has arrived" req = request(teller) patience = rand(Uniform(MIN_PATIENCE, MAX_PATIENCE)) val = @yield req | timeout(sim, patience) println(val) wait = now(sim) - arrive if in(req, keys(result)) @info "$(now(sim)) $name: Waited $wait" @yield timeout(sim, rand(Exponential(time_in_bank))) @info "$(now(sim)) $name: Finished" @yield release(res) else @info "$(now(sim)) reneged after $wait" @yield cancel(res, req) end end