Boost logo

Boost :

From: dizzy (dizzy_at_[hidden])
Date: 2008-08-07 04:33:54


On Thursday 07 August 2008 04:00:39 Felipe Magno de Almeida wrote:
> I'm writing a GUI library, and I wanted to use the asio concepts in it.
> For example, I find it very compelling that every window has a
> member-function that returns a io_service::strand to which one
> can post messages to the window thread.
> This would work well with all mainstream toolkits and the win32 API.
> But how would this work with asio implementation?
> Can a service be appended to a io_service, and have its own
> demultiplexer function control the thread running the run member
> function?

You can make your own service that has a thread of its own (like the resolver
service does) and from it you can post() events to the io_service event queue
so that the thread(s) that perform run() on the io_service will handle them.

This is a pretty generic way one can handle any asynchronous sources to asio
(by using additional threads).

-- 
Mihai RUSU					Email: dizzy_at_[hidden]
			"Linux is obsolete" -- AST

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk