java - Terminating ThreadPool-Threads hanging in swt syncExec -


when disposing display threadpool threads hang in swt syncexec call. how can avoid situation , cleanly shutdown threads? calling shutdownnow inside shell disposelistener not work.

the following example shows runnable executed threadpool thread. can find complete code here: http://www.java-forum.org/awt-swing-javafx-and-swt/164617-threadpool-sicher-beenden-verwendung-swt-widgets-display-syncexec.html

private class dosomething implements runnable {     public void run() {       try { thread.sleep( 500 ); } catch( interruptedexception e ) {e.printstacktrace();}       if( !shell.isdisposed() ) {         display.syncexec( new runnable() {             public void run() {               drawshit( display );             }          });       }       }   } } 

the syncexec() calls in dosomething causing dead lock. if replace syncexec() asyncexec() thread pool shut down fine. there specific reason why use syncexec()?

alternatively should able run shutdown code separate thread avoid problem.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -