Index: src/uk/me/parabola/mkgmap/main/Main.java
===================================================================
--- src/uk/me/parabola/mkgmap/main/Main.java	(revision 4139)
+++ src/uk/me/parabola/mkgmap/main/Main.java	(working copy)
@@ -93,6 +93,9 @@
 	private ExecutorService threadPool;
 	// default number of threads
 	private int maxJobs = 0;
+	private boolean keepGoingOnError = false;
+	private int numMapFailedExceptions = 0;
+	private List<FilenameTask> filenames = new ArrayList<>();
 
 	private boolean createTdbFiles = false;
 	private boolean tdbBuilderAdded = false;
@@ -486,8 +489,47 @@
 		combinerMap.put(name, combiner);
 		combiners.add(combiner);
 	}
+	
+	private boolean GetTaskResult(FilenameTask future) {
+		try {
+			try {
+				// don't call get() until a job has finished
+				if (future.isDone()) {
+					// Provoke any exceptions by calling get and then
+					// save the result for later use
+					future.setFilename(future.get());
+					filenames.add(future);
+					return true;
+				}
+			} catch (ExecutionException e) {
+				// Re throw the underlying exception
+				Throwable cause = e.getCause();
+				if (cause instanceof Exception)
+					//noinspection ProhibitedExceptionThrown
+					throw (Exception) cause;
+				else if (cause instanceof Error)
+					//noinspection ProhibitedExceptionThrown
+					throw (Error) cause;
+				else
+					throw e;
+			}
+		} catch (OutOfMemoryError | ExitException e) {
+			throw e;
+		} catch (MapFailedException mfe) {
+//			System.err.println(mfe.getMessage()); // already printed via log
+			numMapFailedExceptions++;
+			setProgramRC(-1);
+		} catch (Throwable t) {
+			t.printStackTrace();
+			if (!keepGoingOnError) {
+				throw new ExitException("Exiting - if you want to carry on regardless, use the --keep-going option");
+			}
+		}
+		return false;
+	}
 
 	public void endOptions(CommandArgs args) {
+		keepGoingOnError = args.getProperties().getProperty("keep-going", false);
 		fileOptions(args);
 
 		log.info("Start tile processors");
@@ -497,7 +539,7 @@
 		if (threadPool == null) {
 			if (threadCount == 0) {
 				threadCount = 1;
-				if (taskCount > 2) {
+				if ((taskCount > 2) && (runtime.availableProcessors() > 1)) {
 					//run one task to see how much memory it uses
 					log.info("Max Memory: " + runtime.maxMemory());
 					futures.get(0).run();
@@ -517,6 +559,8 @@
 					threadCount = Math.max(threadCount, 1);
 					threadCount = Math.min(threadCount, runtime.availableProcessors());
 					System.out.println("Setting max-jobs to " + threadCount);
+					FilenameTask future = futures.remove(0);
+					GetTaskResult(future);
 				}
 			}
 
@@ -528,50 +572,18 @@
 		for (FilenameTask task : futures) {
 			threadPool.execute(task);
 		}
-
-
-		List<FilenameTask> filenames = new ArrayList<>();
-		
-		int numMapFailedExceptions = 0;
-		
+				
 		if (threadPool != null) {
 			threadPool.shutdown();
 			while (!futures.isEmpty()) {
-				try {
+				if (GetTaskResult(futures.get(0)))
+					futures.remove(0);
+				else {
 					try {
-						// don't call get() until a job has finished
-						if (futures.get(0).isDone()) {
-							FilenameTask future = futures.remove(0);
-
-							// Provoke any exceptions by calling get and then
-							// save the result for later use
-							future.setFilename(future.get());
-							filenames.add(future);
-						} else
-							Thread.sleep(100);
-					} catch (ExecutionException e) {
-						// Re throw the underlying exception
-						Throwable cause = e.getCause();
-						if (cause instanceof Exception)
-							//noinspection ProhibitedExceptionThrown
-							throw (Exception) cause;
-						else if (cause instanceof Error)
-							//noinspection ProhibitedExceptionThrown
-							throw (Error) cause;
-						else
-							throw e;
+						Thread.sleep(100);
+					} catch (InterruptedException e) {
+						throw new ExitException("Exiting due to interruption");
 					}
-				} catch (OutOfMemoryError | ExitException e) {
-					throw e;
-				} catch (MapFailedException mfe) {
-//					System.err.println(mfe.getMessage()); // already printed via log
-					numMapFailedExceptions++;
-					setProgramRC(-1);
-				} catch (Throwable t) {
-					t.printStackTrace();
-					if (!args.getProperties().getProperty("keep-going", false)) {
-						throw new ExitException("Exiting - if you want to carry on regardless, use the --keep-going option");
-					}
 				}
 			}
 		}
@@ -585,7 +597,7 @@
 		boolean hasFiles = false;
 		for (FilenameTask file : filenames) {
 			if (file == null || file.isCancelled() || file.getFilename() == null){
-				if (args.getProperties().getProperty("keep-going", false))
+				if (keepGoingOnError)
 					continue;
 				else 
 					throw new ExitException("Exiting - if you want to carry on regardless, use the --keep-going option");
