Boost logo

Boost Users :

Subject: [Boost-users] Does io_service::post() block while io_service is busy?
From: Andreas Wehrmann (a.wehrmann_at_[hidden])
Date: 2012-04-12 10:01:34


I have a question about the behaviour of asio::io_service when it comes
to executing previously posted work while trying to post even more work.

I have two threads, one of which is the worker thread that runs
io_service::run() and the other one that runs with a high priority and
uses io_service::post() to relay processing of incoming requests via
network to the worker thread (this has to be fast).

The question is:
When the worker thread is currently executing work (of which there may
be a lot) which the high priority thread previously posted to it,
is the io_service locked?; so that calls to io_service::post() block
until the io_service is done?

I came to this question because I saw that in ::post() there is a lock
involved protecting access to the operations queue.

Regards,

Andreas

-- 
Dipl.-Ing. (FH) Andreas Wehrmann
Software Development
--------------------------------------------------------------
Center Communication Systems GmbH
A-1210 Wien, Ignaz-Köck-Straße 19
Sitz in Wien
FN 796 88p, Firmenbuchgericht Wien
www.centersystems.com
Tel.: +43 (0) 190 199 - 3616
Mobile: +43 (0) 664 884 75916
Fax: +43 (0) 190 199 - 2110
E-Mail: a.wehrmann_at_[hidden]

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