From 45ff6442342b01cb0cb4ae7655d3c55737564e40 Mon Sep 17 00:00:00 2001 From: Stephan Saalfeld Date: Tue, 21 Jun 2011 13:44:42 +0200 Subject: [PATCH] Fixed Thread interruption in Align.connectTilePairs (feature extraction and matching). --- mpicbg/trakem2/align/Align.java | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/mpicbg/trakem2/align/Align.java b/mpicbg/trakem2/align/Align.java index c94862b2..051a030a 100644 --- a/mpicbg/trakem2/align/Align.java +++ b/mpicbg/trakem2/align/Align.java @@ -900,6 +900,7 @@ public class Align extractFeaturesThreads.add( thread ); thread.start(); } + try { for ( final ExtractFeaturesThread thread : extractFeaturesThreads ) @@ -907,7 +908,17 @@ public class Align } catch ( InterruptedException e ) { - IJ.log( "Feature extraction failed.\n" + e.getMessage() + "\n" + e.getStackTrace() ); + Utils.log( "Feature extraction interrupted." ); + for ( final Thread thread : extractFeaturesThreads ) + thread.interrupt(); + try + { + for ( final Thread thread : extractFeaturesThreads ) + thread.join(); + } + catch ( InterruptedException f ) {} + Thread.currentThread().interrupt(); + IJ.showProgress( 1.0 ); return; } @@ -926,8 +937,17 @@ public class Align } catch ( InterruptedException e ) { - IJ.log( "Establishing feature correspondences failed.\n" + e.getMessage() + "\n" + e.getStackTrace() ); - return; + Utils.log( "Establishing feature correspondences interrupted." ); + for ( final Thread thread : matchFeaturesAndFindModelThreads ) + thread.interrupt(); + try + { + for ( final Thread thread : matchFeaturesAndFindModelThreads ) + thread.join(); + } + catch ( InterruptedException f ) {} + Thread.currentThread().interrupt(); + IJ.showProgress( 1.0 ); } } -- 2.11.4.GIT