# Experience with using SimJulia

**URL:** <https://discourse.julialang.org/t/experience-with-using-simjulia/20232>\
**Category:** Modelling & Simulations\
**Created:** [January 29, 2019, 1:05pm UTC](https://discourse.julialang.org/t/experience-with-using-simjulia/20232 "2019-01-29T13:05:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![stroebel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stroebel/32/6774_2.png) [@stroebel](https://discourse.julialang.org/u/stroebel)\
**Post date:** [January 29, 2019, 1:05pm UTC](https://discourse.julialang.org/t/experience-with-using-simjulia/20232/1 "2019-01-29T13:05:25Z")

</div>

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.

```julia
@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

```

---

<div class="post-metadata">

**Author:** ![hdavid16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hdavid16/32/11531_2.png) [@hdavid16](https://discourse.julialang.org/u/hdavid16)\
**Post date:** [May 23, 2021, 1:54am UTC](https://discourse.julialang.org/t/experience-with-using-simjulia/20232/2 "2021-05-23T01:54:19Z")

</div>

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.
