Experience with using SimJulia

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

Hi @stroebel,

What is result in your if block? I suspect that the line with val is completing the timeout event first, which has no value associated with it. Thus, val = nothing, which is why you don’t get a printout. Let me know if you still need any help with this example and we can debug futher.