Boost Users :
Subject: [Boost-users] How to post a work into a io_service and wait for it run complete?
From: ä]µË (tdzl2003_at_[hidden])
Date: 2009-03-18 06:33:55
I created a io_service in main thread, for dispatch user request. And i
created another io_service in a thread_pool, run some sync
work(like database query).
After main thread got some user request, it post a query into the io_service
running in the thread_pool. After the query has been completed, query thread
post a work to the main thread. But the next query cannot be handled until
the last result was closed. So query thread need to wait main thread until
it'll not using the result any more.
How to do it? Now I write some code with mutex and condition_variables. but
is there any better choice with out such things?
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