#31 Ability to interrupt threads and InterruptedExceptions

open
nobody
Other (7)
5
2015-01-09
2007-01-21
Anonymous
No

I come from the Java world where your library is part of the Java SDK.

In Java, there are ways to interrupt threads from their blocking operations.

For example, the wait() operation on class Object throws InterruptedException. Therefore, I can ask that the wait be canceled.

This allows me to write the following code without a problem:

class A extends Runnable{

void run(){

      synchronized(this){
            try{
                this.wait();
            } catch(InterruptedException e){
                //happens if this thread is interrupted by a call to Thread.interrupt();
            }
}

}

In Java, I can interrupt this thread, thus making it exit. In POCO, I do not see such a mechanism. Therefore, I assume that wait() waits forever for another thread to signal it. The recipient thread now has to determine whether it should close or go on and do some work.

I would like to see Thread interruption and all blocking calls in the library to be capable of being interrupted. I would expect an InterruptedException to be thrown if that is the case.

Thanks,

Ronak Patel (ronak2121) ronak.patel@baesystems.com

Discussion

  • Logged In: NO

    in poco, there's a wrapper for threads: tasks - these support status & control functionality