title: Custom Boost Asio IO object
body: <p>I am new to boost asio.
  I've read this comparison: <em>How does libuv compare to Boost/ASIO?</em> (Dead link)</p>
  
  <p>It turned out that there is an opportunity to use asio's event loop for other reasons but socket programming. I am planning to use this async event loop for processing messages coming from the UI. <br />
  So far I have a concurrent queue and I would like to implement my own boost::asio IO object. The goal is to use this object as you can see here:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;boost/asio.hpp&gt;
  #include "MProcessor.h"
  #include "concurrent_queue.h"
  
  void foo(const boost::system::error_code&amp; /*e*/)
  {
    std::cout &lt;&lt; "got message" &lt;&lt; std::endl;
  }
  
  int main()
  {
    concurrent_queue&lt;int&gt; messages;
    /* ... */
    boost::asio::io_service io;
  
    MProcessor t(io, &amp;messages);
    t.async_wait(&amp;foo);
  
    io.run();
  
    return 0;
  }
  </code></pre>
  
  <p>So the aim is to keep busy the io_service by an IO object which is able to call a function asynchronously (foo), when the queue (messages) has a message can be popped. The queue has a method called <strong>wait_and_pop</strong>. It blocks the caller thread until the queue has something to pop, than it returns with the popped item value.<br />
  I am stucked at this point, and I couldn't find any boost asio tutorial online without sockects. There are some similar questions, but those all use sockets.
  Any idea how to implement my own IO object? Or am I missing any important obstacles? Thank you very much!</p>