Boost C++ Libraries: Ticket #3254: Cannot cancel async_write to a serial port https://svn.boost.org/trac10/ticket/3254 <p> Attached is a test program that demonstrates some curious behavior I see while using serial port on a Linux system (epoll reactor). </p> <p> The order of operations is: create serial_port, call async_write to send some data over the port, call cancel to cancel the write operation, enter io_service. </p> <p> I would expect the write completion handler to be called with the error_code argument set. Instead, no error_code is set and some bytes are transferred. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3254 Trac 1.4.3 kevin.arunski@… Wed, 08 Jul 2009 20:22:20 GMT attachment set https://svn.boost.org/trac10/ticket/3254 https://svn.boost.org/trac10/ticket/3254 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">serial_test.cpp</span> </li> </ul> <p> Async write cancel test </p> Ticket kevin.arunski@… Thu, 09 Jul 2009 12:39:03 GMT <link>https://svn.boost.org/trac10/ticket/3254#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3254#comment:1</guid> <description> <p> I think I've traced the problem to the speculative write code path in the reactor service. The write is sent to the file descriptor ahead of queueing a work operation. So there is no way for the cancel operation to find the pending write operation. So I would think the speculative write path would need to at least provide some mechanism for the cancel operation to find the write operation and deliver the error code to the handler. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Tue, 12 Jan 2010 22:40:25 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3254#comment:2 https://svn.boost.org/trac10/ticket/3254#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> This is expected behaviour. The async operation can complete any time from when you call async_write to when your handler runs. In this case it completes immediately, is no longer pending, and so there is nothing to cancel. </p> Ticket