From: Gruenke, Matt <mgruenke@Tycoint.com> - 2013-06-14 19:17:53
Can anyone explain why? Are there any locks held while executing
completion handlers? Or does this advice originate purely from a
standpoint of not wanting to let the connection go idle?
From: Green, Cliff [mailto:cliff.green@...]
Sent: June 14, 2013 13:47
Subject: Re: [asio-users] Async HTTP and requests requiring long
>> ... Recently we added a new feature that requires a long processing
time like 10 minutes.
As Guilherme has already recommended, queuing the work to another thread
is the way to go. This is a general recommendation for Asio design - if
a handler is going to take a "long" time to complete, pass the work off
to something else. I generally do all network event processing in one
thread - i.e. all Asio related work is in a single thread (which
simplifies a lot of issues), and if functionality is needed that is
compute or IO intensive, that work is passed to another thread (which
knows nothing about network / Asio). Sometimes the design can get a bit
complicated when dealing with "transactional" type network requests, but
there are straightforward solutions.
Get latest updates about Open Source Projects, Conferences and News.