Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost-users][asio] timeout-isio_service.reset()safe with pool of threads?
From: tomasz jankowski (tomasz_jacek_at_[hidden])
Date: 2009-02-03 05:57:22


Dnia 3-02-2009 o godz. 10:51 Igor R napisał(a):
I don't understand how it works :(. we have few io_service object which are run() in separated threads. but only one is maintained by async_accept chain trick. the rest run() should immediately return.
 
Please, read that example carefully, there's an explanation inside. You've got special "work" object that prevents io_service::run from stopping.
 

hymm, it is really hard to understand what work object is doing because in my opinion explanations " Give all the io_services work to do so that their run() functions will not exit until they are explicitly stopped." are not equal with doc's "The work class is used to inform the io_service when work starts and finishes. This ensures that the io_service's run() function will not exit while work is underway, and that it does exit when there is no unfinished work remaining. " 

because of it I did not caught meaning of work's work ;)
ok, I know now how it works.
thanks Igor,


But I have another question, about "http server 3" example where we have one io_service and pool of threads for it. I have written  simple example where  3 computation tasks are scheduled in one io_service than pool of three thread is run for it. tasks are performed in parallel mode - each one in separate thread. I understand it.  
 
but I don't know for what there is pool of threads in "http server 3" example. there is only one scheduled task - async_accept. So, in my opinion only one thread will be doing whole job.


tj



----------------------------------------------------
Twoja rodzina na bliscy.pl
Zobacz:
http://klik.wp.pl/?adr=http://corto.www.wp.pl/as/bliscy.html&sid=628

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net