From b7f76cbf47a98425ee1d850ecc9eb8673ff4f960 Mon Sep 17 00:00:00 2001
From: hoijui <hoijui.quaero@gmail.com>
Date: Tue, 22 Feb 2011 14:50:53 +0100
Subject: [PATCH] fix dead-lock in ViewMap on single core systems

---
 .../examples/hyperassociativemap/visualization/ViewMap.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/main/java/com/syncleus/dann/examples/hyperassociativemap/visualization/ViewMap.java b/src/main/java/com/syncleus/dann/examples/hyperassociativemap/visualization/ViewMap.java
index 09b895b..1b0026d 100644
--- a/src/main/java/com/syncleus/dann/examples/hyperassociativemap/visualization/ViewMap.java
+++ b/src/main/java/com/syncleus/dann/examples/hyperassociativemap/visualization/ViewMap.java
@@ -42,7 +42,9 @@ public class ViewMap extends JFrame implements ActionListener
 
 	public ViewMap()
 	{
-		this.executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
+		// With only 1 thread, we would get a dead-lock when
+		// the view-update-thread is waiting for the alignment.
+		this.executor = Executors.newFixedThreadPool(Math.max(2, Runtime.getRuntime().availableProcessors()));
 		this.associativeMap = new LayeredHyperassociativeMap(8, executor);
 
 		HyperassociativeMapCanvas myMapVisual = null;
-- 
GitLab