Boost logo

Boost :

From: Martin Bonner (Martin.Bonner_at_[hidden])
Date: 2008-04-07 09:58:05

----Original Message----
From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]] On Behalf Of Sebastian Redl
Sent: 07 April 2008 14:23 To: boost_at_[hidden]
Subject: Re: [boost] Asynchronous Boost.Iostreams with Boost.Asio

> Boris wrote:
>> On Mon, 07 Apr 2008 11:40:48 +0200, Sebastian Redl
>> <sebastian.redl_at_[hidden]> wrote:
>>> The only way to simulate asynchronous I/O using blocking calls is
>>> to use a separate thread for every I/O object.
>> This doesn't work either as you can't interrupt the blocking call if
>> you want to close the stream.
> You can kill the thread. Not exactly portable, and will probably leak
> resources, though.

Not a good plan. We have recently run into a problem where our
application would not shut down because a library had used
TerminateThread to (ahem) terminate a thread. The thread had been
holding a Critical Section (Win32 within-process-only mutex), and when
some other thread tried to acquire the critical section there was a
rather long wait for the terminated thread to release it.

It is extremely difficult to know what resources IOStreams will use
internally, but protecting access via a critical section seems entirely

Martin Bonner
Senior Software Engineer/Team Leader
Telephone: +44 1223 441434 / 203894 (direct)
Fax: +44 1223 203999
Email: martin.bonner_at_[hidden]

Boost list run by bdawes at, gregod at, cpdaniel at, john at