Hi

I would like to migrate an application from using Glib::Source (glibmm event loop) to use io_service instead.

The application is using glib::sources for two job:
- Drive lots of network IO connection
- Process internal event which are generated in side the application it self.

The Io part is easy to fit into asio, but I'm having problems seeing what the best way is to implement the core application event processing.

Using glib::source I could register an interface where two function is called:

bool prepare (int &timeout);
bool dispatch (sigc::slot_base *slot);

Prepare could set a time out identifying how much time should elapse before dispatch is ready to process an event.

When the time is passed, the glib main loop will call the dispatch function, where I then can process the internal events.

How can this be implemented in boost::asio io_service?

I have look at the section 7.5 in http://en.highscore.de/cpp/boost/asio.html but he is using a thread and a blocking call. Using a thread is not a solution in my case.

I would rather like either polling, or some kind of scheduling...

I any body has some hints, examples, advices it would be most appreciated.

--
Allan W. Nielsen