Boost C++ Libraries: Ticket #8799: named condition notify_all does not wake up waiting process https://svn.boost.org/trac10/ticket/8799 <p> The underlying snippet never catches the notify_all() signal. Operating System used is Linux 3.5.0-17-generic. </p> <p> Can anybody confirm this as a bug or am I doing something wrong? </p> <h3 class="section" id="Codesnippet">Code snippet</h3> <pre class="wiki">#include &lt;iostream&gt; #include &lt;boost/interprocess/sync/named_condition.hpp&gt; #include &lt;boost/interprocess/sync/named_mutex.hpp&gt; #include &lt;boost/interprocess/sync/scoped_lock.hpp&gt; #include &lt;boost/interprocess/shared_memory_object.hpp&gt; #include &lt;boost/interprocess/mapped_region.hpp&gt; #include &lt;boost/version.hpp&gt; #include &lt;sys/types.h&gt; #include &lt;sys/wait.h&gt; using namespace std; using namespace boost::interprocess; void* consumer(void*) { cout &lt;&lt; "Started child" &lt;&lt; endl; named_mutex mtx(create_only, "somemutex"); named_condition signal_empty (create_only, "signal_empty"); for(;;) { cout &lt;&lt; "Child tries to lock" &lt;&lt; endl; scoped_lock&lt;named_mutex&gt; lock(mtx); cout &lt;&lt; "Child got lock and waits" &lt;&lt; endl; signal_empty.wait(lock); cout &lt;&lt; "Child WOKE up" &lt;&lt; endl; } cout &lt;&lt; "Finished child" &lt;&lt; endl; } void* producer(void*) { cout &lt;&lt; "Started parent" &lt;&lt; endl; sleep(1); named_mutex mtx(open_only, "somemutex"); named_condition signal_empty (open_only, "signal_empty"); for(;;) { cout &lt;&lt; "Parent tries to get lock" &lt;&lt; endl; scoped_lock&lt;named_mutex&gt;lock(mtx); cout &lt;&lt; "Parent got lock and notifies" &lt;&lt; endl; sleep(1); cout &lt;&lt; "Parent notifies child" &lt;&lt; endl; signal_empty.notify_all(); } } int main(int argc, char** argv) { pid_t pid = fork(); if(pid == 0) { consumer(NULL); } else { producer(NULL); } } </pre><h3 class="section" id="Applicationoutput">Application output</h3> <pre class="wiki">Started parent Started child Child tries to lock Child got lock and waits Parent tries to get lock Parent got lock and notifies Parent notifies child Parent tries to get lock Parent got lock and notifies ..... </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8799 Trac 1.4.3 Ion Gaztañaga Tue, 15 Oct 2013 20:26:56 GMT <link>https://svn.boost.org/trac10/ticket/8799#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8799#comment:1</guid> <description> <p> I can't see anything wrong in the code. Can you test it with current trunk code to see if current version also does't work? </p> </description> <category>Ticket</category> </item> <item> <author>peter.knafl@…</author> <pubDate>Wed, 16 Oct 2013 20:37:52 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8799#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8799#comment:2</guid> <description> <p> hi! thanks for the reply. I will do that asap an comment here again. </p> </description> <category>Ticket</category> </item> <item> <author>stefan.maagh@…</author> <pubDate>Thu, 06 Mar 2014 08:35:53 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8799#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8799#comment:3</guid> <description> <p> This code works fine for boost version 1.55 </p> </description> <category>Ticket</category> </item> <item> <author>stefan.maagh@…</author> <pubDate>Thu, 06 Mar 2014 08:46:48 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8799#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8799#comment:4</guid> <description> <p> Sorry, my comment above is wrong!!! This code does not work in 1.55! </p> </description> <category>Ticket</category> </item> <item> <author>Yochai Timmer <yochait@…></author> <pubDate>Fri, 24 Oct 2014 09:28:58 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8799#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8799#comment:5</guid> <description> <p> Happens on windows too (visual studio 2012). Seems like it's less probable though, happens randomly after a few hours sometimes. </p> </description> <category>Ticket</category> </item> </channel> </rss>