Boost C++ Libraries: Ticket #4854: boost ptr_list serious problem https://svn.boost.org/trac10/ticket/4854 <p> I have defined a struct like below: there is a mutex in it. I just found this mutex cannot cross-thread,strang? But stl c++ list works well. It doesn't have such a strange problem. struct { ..... ptr_list&lt;<a class="missing wiki">SeppContext</a>&gt; freeContextList; } when i invoke freeContextList.mutex1, I try: </p> <blockquote> <p> freeContextList.mutex1.lock(); </p> </blockquote> <p> then a boost lock error jumped up. It is not my codes'problem. It is the problem of ptr_list of boost. strange? </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4854 Trac 1.4.3 Marshall Clow Mon, 15 Nov 2010 22:17:44 GMT <link>https://svn.boost.org/trac10/ticket/4854#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4854#comment:1</guid> <description> <p> Can you post a complete code example, please? </p> <p> Something that we can try to compile? </p> </description> <category>Ticket</category> </item> <item> <author>davidmahorse@…</author> <pubDate>Tue, 16 Nov 2010 06:58:29 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4854#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4854#comment:2</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/4854#comment:1" title="Comment 1">marshall</a>: </p> <blockquote class="citation"> <p> Can you post a complete code example, please? </p> <p> Something that we can try to compile? </p> </blockquote> <p> I cannot upload my source.It is too big even if after I make clean. I have tested today. It is still a problem. If you want talk me in detail. You can join me in MSN my msn is: david_mahorse@… I could send my full source to you by pidgin of ubuntu 10.04. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 27 Nov 2010 14:47:55 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4854#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4854#comment:3</guid> <description> <p> Please could you clarify what is the context and the error? </p> </description> <category>Ticket</category> </item> <item> <author>davidmahorse@…</author> <pubDate>Sat, 27 Nov 2010 15:59:45 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4854#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4854#comment:4</guid> <description> <p> struct <a class="missing wiki">SeppContext</a> { ..... </p> <blockquote> <p> mutex lockForSingleContext;<em>mutex is a stand version of boost. </em></p> </blockquote> <p> ..... } </p> <p> class sepp { .... <em>list&lt;<a class="missing wiki">SeppContext</a>*&gt; freeContextList; </em>this stl list works fine ptr_list&lt;<a class="missing wiki">SeppContext</a>&gt; freeContextList;<em>this doesn't work ,it cannot </em>crossthread such as epoll linux kernel } </p> <p> I was trying to test my codes to handle exception: so I deliberately throw an exception in one function invoked by epoll threads which I defined. This exception is created by this sentence like that: ... scoped_array&lt;char&gt; pa(new char[0x7fffffff]); .... then I just didn't know there is a problem with ptr_list of boost. I just get strange exception of "boost lock" captured by my threads. At this time ,this point of "<a class="missing wiki">SeppContext</a>" has entered in linux kernel of epoll and comes out. I traced where this exception comes from, then I find : .... pContext = freeContextList.back(); freeContextList.pop_back(); pContext-&gt;lockForSingleContext.lock();<em>this sentence throws boost lock </em>exception .... But I have found this point of pContext is good. The address of pContext is not changed by kernel of linux. But I can invoke other variable of this pContext. But I cannot invoke the mutex of lockForSingleContext in <a class="missing wiki">SeppContext</a>. If I invoke then a boost lock exception jumps out. I have't use static_cast such things. Because I only have one process,but it is mult-threaded. And if I don't use ptr_list of boost, I find std list works fine. It doesn't throw boost lock exception. So I judge this is not the problem of my codes. It is the problem of boost ptr_list. I just found another serious problem of ip:tcp:socket. The socket handle in it cannot cross-thread. The problem is I cannot delete point of ip:tcp:socket to release socket handle. This point of ip:tcp:socket is also defined in <a class="missing wiki">SeppContext</a>. It is not the problem of my codes. It is the problem of ASIO of boost.Trust me. I don't use ASIO now. I just use BSD socket raw functions. It works fine. All my environment is multi-threads and epoll things. Because I am doing basic network programming. </p> </description> <category>Ticket</category> </item> <item> <author>davidmahorse@…</author> <pubDate>Sat, 27 Nov 2010 16:14:46 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4854#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4854#comment:5</guid> <description> <p> Why don't you join me in google talk to know detail of it? My gmail and account of google of talk is: davidmahorse@… </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Mon, 29 Nov 2010 15:47:47 GMT</pubDate> <title>component changed; owner set https://svn.boost.org/trac10/ticket/4854#comment:6 https://svn.boost.org/trac10/ticket/4854#comment:6 <ul> <li><strong>owner</strong> set to <span class="trac-author">Thorsten Ottosen</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">ptr_container</span> </li> </ul> Ticket Thorsten Ottosen Thu, 31 Mar 2011 20:29:02 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4854#comment:7 https://svn.boost.org/trac10/ticket/4854#comment:7 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> Ticket