How to post a work into a io_service and wait for it run complete?
18 Mar
2009
18 Mar
'09
10:33 a.m.
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?
5733
Age (days ago)
5733
Last active (days ago)
0 comments
1 participants
participants (1)
-
�]邓