Boost C++ Libraries: Ticket #8540: Named Condition Variable hanging. https://svn.boost.org/trac10/ticket/8540 <p> Hi, </p> <p> I am having problems with the shared memory code below. I can get this working on a Windows, MAC and OpenSUSE machine. However this same code does not work on my redhat v5.0 workstation machine. </p> <p> It appears to hang on the wait (condition variable). Any idea why this would be the case on this particular OS? I can't find anything online on the subject. </p> <p> Website of code: <a class="ext-link" href="http://en.highscore.de/cpp/boost/interprocesscommunication.html#interprocesscommunication_managed_shared_memory"><span class="icon">​</span>http://en.highscore.de/cpp/boost/interprocesscommunication.html#interprocesscommunication_managed_shared_memory</a> </p> <p> #include &lt;boost/interprocess/managed_shared_memory.hpp&gt; #include &lt;boost/interprocess/sync/named_mutex.hpp&gt; #include &lt;boost/interprocess/sync/named_condition.hpp&gt; #include &lt;boost/interprocess/sync/scoped_lock.hpp&gt; #include &lt;iostream&gt; </p> <p> int main() { </p> <blockquote> <p> boost::interprocess::managed_shared_memory managed_shm(boost::interprocess::open_or_create, "shm", 1024); int *i = managed_shm.find_or_construct&lt;int&gt;("Integer")(0); boost::interprocess::named_mutex named_mtx(boost::interprocess::open_or_create, "mtx"); boost::interprocess::named_condition named_cnd(boost::interprocess::open_or_create, "cnd"); boost::interprocess::scoped_lock&lt;boost::interprocess::named_mutex&gt; lock(named_mtx); while (*i &lt; 10) { </p> <blockquote> <p> if (*i % 2 == 0) { </p> <blockquote> <p> ++(*i); named_cnd.notify_all(); named_cnd.wait(lock); </p> </blockquote> <p> } else { </p> <blockquote> <p> std::cout &lt;&lt; *i &lt;&lt; std::endl; ++(*i); named_cnd.notify_all(); named_cnd.wait(lock); </p> </blockquote> <p> } </p> </blockquote> <p> } named_cnd.notify_all(); boost::interprocess::shared_memory_object::remove("shm"); boost::interprocess::named_mutex::remove("mtx"); boost::interprocess::named_condition::remove("cnd"); </p> </blockquote> <p> } </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8540 Trac 1.4.3 viboes Mon, 13 May 2013 21:32:21 GMT component changed; owner set https://svn.boost.org/trac10/ticket/8540#comment:1 https://svn.boost.org/trac10/ticket/8540#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Ion Gaztañaga</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">interprocess</span> </li> </ul> Ticket