Boost C++ Libraries: Ticket #6548: boost asio async_accept thread context https://svn.boost.org/trac10/ticket/6548 <p> how to see the problem: 1) compile attached cpp 2) run program 2) accept /tmp/test unix socket more than 2 times </p> <p> the output <strong>will</strong> be like: start from 0x1215810 start from 0x12154c0 <strong>accept from 0x12154c0, async_accept from 0x1215810</strong> accept from 0x12154c0, async_accept from 0x12154c0 and program is still <strong>running</strong>! </p> <p> the output <strong>should</strong> be like: start from 0x1215810 start from 0x12154c0 <strong>accept from 0x1215810, async_accept from 0x1215810</strong> accept from 0x12154c0, async_accept from 0x12154c0 and program should <strong>stop</strong>! </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6548 Trac 1.4.3 aladjev.andrew@… Sun, 12 Feb 2012 16:54:45 GMT attachment set https://svn.boost.org/trac10/ticket/6548 https://svn.boost.org/trac10/ticket/6548 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">asio_bug.cpp</span> </li> </ul> Ticket anonymous Sun, 12 Feb 2012 16:57:36 GMT <link>https://svn.boost.org/trac10/ticket/6548#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6548#comment:1</guid> <description> <p> the output will be like: </p> <p> start from 0x1215810<br /> start from 0x12154c0<br /> <strong>accept from 0x12154c0, async_accept from 0x1215810</strong><br /> accept from 0x12154c0, async_accept from 0x12154c0 </p> <p> and program is still <strong>running</strong>! </p> <p> the output should be like: </p> <p> start from 0x1215810<br /> start from 0x12154c0<br /> <strong>accept from 0x1215810, async_accept from 0x1215810</strong><br /> accept from 0x12154c0, async_accept from 0x12154c0 </p> <p> and program should <strong>stop</strong>! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Tue, 29 May 2012 01:18:17 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/6548#comment:2 https://svn.boost.org/trac10/ticket/6548#comment:2 <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> <p> Your conclusion is not correct. There is only one acceptor object, and all of its completion handlers will be delivered through its associated io_service, which in this case is <code>io_1</code>. Which thread you start the <code>async_accept</code> operation from does not matter. </p> <p> The program does not stop because you have created <code>io_service::work</code> objects that you do not destroy. See <a href="http://www.boost.org/doc/libs/1_49_0/doc/html/boost_asio/reference/io_service.html#boost_asio.reference.io_service.stopping_the_io_service_from_running_out_of_work">here</a> for more details. </p> Ticket