M
Miki Tebeka
Hello All,
I'm looking for a way to "yield" an exception.
Background: I'm writing a hardware simulator. I have an output buffer
and need to freeze when it's full and then when called again to resume
execution from the point where it stopped.
Currently all I can think of is to use a class and save the state when
throwing an exception. However this required manual book keeping of the
current state (and it is complicated).
I'd like to use generators but can't see any "nice" way of doing it.
What I'd like it to throw an exception when the buffer is full and then
next time the generator is called to continue execution as after a
"yield".
Is this possible?
Can you recommend a good way of doing this? Any state machine?
Thanks.
Bye.
I'm looking for a way to "yield" an exception.
Background: I'm writing a hardware simulator. I have an output buffer
and need to freeze when it's full and then when called again to resume
execution from the point where it stopped.
Currently all I can think of is to use a class and save the state when
throwing an exception. However this required manual book keeping of the
current state (and it is complicated).
I'd like to use generators but can't see any "nice" way of doing it.
What I'd like it to throw an exception when the buffer is full and then
next time the generator is called to continue execution as after a
"yield".
Is this possible?
Can you recommend a good way of doing this? Any state machine?
Thanks.
Bye.