[gambit-list] How best cancel a read/write-subu8vector or ##device-port-wait-for-input/output! from another thread gracefully? (for abort operation on active HTTP request etc.)
feeley at iro.umontreal.ca
Wed Mar 20 13:33:46 EDT 2013
On 2013-03-20, at 1:09 PM, Mikael <mikael.rcv at gmail.com> wrote:
> Can't wait to try it out!
> (lambda (e)
> (if (inactive-thread-exception? e)
> (raise e)))
> This condition that can make it raise an exception, could that ever be of any practical value beyond typechecking of the thread?
That exception is not raised due to a type check failure. It is raised when the state of the thread is inactive (i.e. it has stopped running). The intent is to inform the caller that the interrupt will not happen in the target thread because it is terminated. I admit that this exception is of limited use because there is a race condition (the interrupt could be requested just before the thread terminates, but after the last point where interrupts are checked, so the interrupt will not be serviced).
> Would probably be interested in making the exception-catcher return #!void always unless if there could come some valuable debug info out of there.
Sure. It is up to you.
More information about the Gambit-list