2014-05-09 20:08 GMT+08:00 Nat Goodspeed <nat(a)lindenlab.com>:
> On May 9, 2014, at 6:18 AM, microcai <microcai(a)fedoraproject.org> wrote:
>
>> 2014-05-05 21:57 GMT+08:00 Nat Goodspeed <nat(a)lindenlab.com>:
>>>
>>
>>> Perhaps you might propose a cross-platform asio API extension that could give you control at the times you want, using the completion-handler mechanism?
>>
>> then there will be endless ways of loops that you need to integrated
>> into asio. glib, qt, WIN32 message loop ... etc.
>
> Understood. I am not proposing that specific message-loop code be absorbed into Asio. I am asking whether you (or any interested reader) might be able to define an extension API that permits / facilitates a consuming Asio application to integrate with any required message loop.
some thing like io_service::wait_events(); but , does not dispatch
the event. I can run seperated thread to call this, then post message
to gui thread, let gui thread run io_service::poll() to dispatch the
handlers;
if the hander is executed in gui thread, we can avoid lots of
synchronization code between gui thread and asio thread( if
io_service::run() has to be run in seperated thread. ).