<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to 6: Error in pool destruction</title><link>https://sourceforge.net/p/threadpool/bugs/6/</link><description>Recent changes to 6: Error in pool destruction</description><atom:link href="https://sourceforge.net/p/threadpool/bugs/6/feed.rss" rel="self"/><language>en</language><lastBuildDate>Wed, 20 Oct 2010 20:59:45 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/threadpool/bugs/6/feed.rss" rel="self" type="application/rss+xml"/><item><title>Error in pool destruction</title><link>https://sourceforge.net/p/threadpool/bugs/6/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Hello. I have the following set of events:&lt;/p&gt;
&lt;p&gt;1. I have a .dll that uses fifo_pool.&lt;/p&gt;
&lt;p&gt;2. Pool gets destructed.&lt;/p&gt;
&lt;p&gt;2.1. terminate_all_workers (wait_for_all_tasks shutdown policy) notify all workers to quit.&lt;/p&gt;
&lt;p&gt;2.2. All workers were already finished with their tasks, so, there's no wait&lt;/p&gt;
&lt;p&gt;2.3.1. Worker threads gets notification they should be quit, they clean up and, at the end, they add themselves to the m_terminated_workers collection&lt;/p&gt;
&lt;p&gt;2.3.2. Back in terminate_all_workers; m_terminated_workers collection is iterated and all threads there are joined. However, at this point, m_terminated_workers collection IS EMPTY. The sequence was notify all and then no wait, so, threads are ready to be run, but, they are possibly not scheduled yet.&lt;/p&gt;
&lt;p&gt;2.4. Pool destructor is done.&lt;/p&gt;
&lt;p&gt;3. My dll is unloaded.&lt;/p&gt;
&lt;p&gt;4. Worker threads eventually get scheduled and BOOM - process crashes because there's no more code to execute.&lt;/p&gt;
&lt;p&gt;Does this explanation makes any sense? Is there a fix for this? Tnx.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">gmit</dc:creator><pubDate>Wed, 20 Oct 2010 20:59:45 -0000</pubDate><guid>https://sourceforge.net5a58ddb32730650e027ef0599b03817fc73c22b3</guid></item></channel></rss>