|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Thread.Interrupt and asynchronous delegatesDuring a call to a synchronous method that takes a while, a thread is
typically not in an interruptible state, so Thread.Interrupt() followed by Thread.Join() will block until the method completes. Does the same apply or are any guarantees given if the method is invoked "blocked asynchronously", that is End<whatever>(Begin<whatever>(...))? I've noticed that when doing this with Socket.Begin/EndConnect(), Thread.Interrupt() *will* interrupt the thread, but is this guaranteed or an accident of implementation? Is the behavior of Thread.Abort() any different in this regard, if the synchronous method in question ultimately executes unmanaged code? The obvious method of using a callback and setting a waitable event from it will always work, of course, and it probably does a much better job of communicating what's going on; that's not what I'm asking. J. |
|||||||||||||||||||||||