[mkgmap-dev] [Patch] Spurious dead main thread
From WanMil wmgcnfg at web.de on Sat Mar 3 15:26:09 GMT 2012
Hi Gerd, thanks for the patch. The problem is the getActiveCount() method. The javadoc tells that it returns the approximate number of active threads. The only chance that the old code dead locks is that getActiveCount() returns 1 but all threads have already been finished and all results have been taken via the completion service. The patch fixes one problem (so I committed it) but as long as we cannot guarantee that getActiveCount() returns the correct number of remaining threads I expect that we might face a problem the other way round: One or more jobs have not been completely finished but the loop exits because getActiveCount() returns 0 (which is *approximately* correct...). So I have to change that once more. WanMil > Hi WanMil, > > the loop in main (performance branch) does not always end, sometimes the > main thread hangs in cmplService.take(); > I guess this happens when the last preparer finishes after the test of > getActiveCount() and before take() is called: > > > do { > try { > cmplService.take(); > } catch (InterruptedException exp) { > System.err.println(exp.getMessage()); > } > } while (((ThreadPoolExecutor) threadPool).getActiveCount()> 0); > > The attached patch solves this problem. > > Gerd > http://gis.19327.n5.nabble.com/file/n5533662/spuriois_hang.patch > spuriois_hang.patch > > > -- > View this message in context: http://gis.19327.n5.nabble.com/Patch-Spurious-dead-main-thread-tp5533662p5533662.html > Sent from the Mkgmap Development mailing list archive at Nabble.com. > _______________________________________________ > mkgmap-dev mailing list > mkgmap-dev at lists.mkgmap.org.uk > http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
- Previous message: [mkgmap-dev] [Patch] Spurious dead main thread
- Next message: [mkgmap-dev] [Patch] Spurious dead main thread
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the mkgmap-dev mailing list