Skip to content

Interrupts could have an *interrupted_event* attribute

Created by: sscherfke

It could be nice if an Interrupt intance thrown into a process had an attribute interrupted_event pointing to the event that the process yielded before it was interrupted. This would allow us to do this:

#!python
try:
    yield env.timeout(1337)
except simpy.Interrupt as interrupt:
    yield interrupt.interrupted_event  # The timeout from above    

However, we should only add this feature if it requires no hacks and doesn’t improve things (like performance) in a negative way. We should also take care of parallel/multiple interrupts at the same time.