Skip to content

Issue with preemption + signal handling at the same time #187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Enchufa2 opened this issue Feb 11, 2019 · 0 comments
Closed

Issue with preemption + signal handling at the same time #187

Enchufa2 opened this issue Feb 11, 2019 · 0 comments
Labels

Comments

@Enchufa2
Copy link
Member

Example:

library(simmer)

new_timeout <- trajectory() %>%
  log_("new timeout") %>%
  timeout(1)

customer <- trajectory() %>%
  seize("res") %>%
  trap("signal", new_timeout) %>%
  timeout(5) %>%
  log_("releasing") %>%
  release("res")

blocker <- trajectory() %>%
  send("signal") %>%
  log_("blocking the resource") %>%
  seize("res") %>%
  timeout(20) %>%
  log_("opening the resource") %>%
  release("res")

env <- simmer() %>%
  add_resource("res", preemptive=TRUE) %>%
  add_generator("customer", customer, at(0)) %>%
  add_generator("blocker", blocker, at(2), priority=10) %>%
  run()
#> 2: blocker0: blocking the resource
#> 22: blocker0: opening the resource
#> 20: customer0: new timeout
#> 21: customer0: releasing

Time goes backwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant