c++ - Custom Boost Asio IO object -


i new boost asio. i've read comparison: how libuv compare boost/asio?

turned out there opportunity use asio's event loop other reasons socket programming. planning use async event loop processing messages coming ui.
far have concurrent queue , implement own boost::asio io object. goal use object can see here:

#include <iostream> #include <boost/asio.hpp> #include "mprocessor.h" #include "concurrent_queue.h"  void foo(const boost::system::error_code& /*e*/) {   std::cout << "got message" << std::endl; }  int main() {   concurrent_queue<int> messages;   /* ... */   boost::asio::io_service io;    mprocessor t(io, &messages);   t.async_wait(&foo);    io.run();    return 0; } 

so aim keep busy io_service io object able call function asynchronously (foo), when queue (messages) has message can popped. queue has method called wait_and_pop. blocks caller thread until queue has pop, returns popped item value.
stucked @ point, , couldn't find boost asio tutorial online without sockects. there similar questions, use sockets. idea how implement own io object? or missing important obstacles? thank much!


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -