Boost logo

Boost Users :

Subject: [Boost-users] asio: i/o cancellation under Linux/ARM broken?
From: Stefan Sichler (stsichler_at_[hidden])
Date: 2008-11-21 10:41:17


I'm developing a major application using asio that is ported to Windows
x86/ia64, Linux x86 and Linux on an ARM processor.
It seems i/o cancellation is broken on Linux/ARM, which is a major problem
for me.

I added a small test case below for demonstration. On Windows, the test case
will work correctly, running the loop 10 times. On Linux, it will hang after
the first loop pass.

Please help!

(boost 1.37, Debian Linux 2.6.27)

Stefan Sichler

>> code follows:

#ifdef WIN32

#include <iostream>
#include <boost/asio.hpp>

using namespace std;
using namespace boost::asio;
using namespace boost::asio::ip;

// boost asio cancellation testcase

bool g_io_completed= false;

void completionHandler(const boost::system::error_code& err, size_t bt) {
        cout<<"completed err="<<err<<" bt="<<bt<<endl;
        g_io_completed= true;

int main(int argc, char* argv[])
        io_service ios;
        udp::socket sock(ios);;

        cout<<"note: if this test hangs, the cancel test failed!"<<endl;

        char buf[64];

        for (int i=0; i<10; ++i)
                cout<<"loop start i="<<i<<endl;
                g_io_completed= false;

                for (int t=0; t<1000; ++t) // spend some time....


                while (!g_io_completed) // wait for completion handler

                cout<<"loop end i="<<i<<endl;

        cout<<"cancel test completed successfully!"<<endl;

        return 0;

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at