Attached patch fixes a bug introduced with r115.
Bug description: Each worker thread stops when it retrieves the last element for one area. This means that only (max-threads-1) areas are really written until the last element. For the other areas some elements are remaining in the working queues.

The patch ensures that a worker thread is finished only if there is no more unfinished area.

WanMil
Index: src/uk/me/parabola/splitter/SplitProcessor.java
===================================================================
--- src/uk/me/parabola/splitter/SplitProcessor.java	(revision 116)
+++ src/uk/me/parabola/splitter/SplitProcessor.java	(working copy)
@@ -371,9 +371,6 @@
 								break;
 							} else if (element == STOP_ELEMENT) {
 								workPackage=null;
-								System.out.println("Thread " + Thread.currentThread().getName() + " has finished");
-								// this writer is finished
-								finished = true;
 								break;
 							} else {
 								processElement(element, workPackage.writer);
@@ -394,6 +391,7 @@
 					}
 				}
 			}
+			System.out.println("Thread " + Thread.currentThread().getName() + " has finished");
 		}
 	}
 }
\ No newline at end of file
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to