Boost logo

Boost :

From: Boris (boris_at_[hidden])
Date: 2005-03-29 11:05:18


Jonathan Wakely wrote:
> On Tue, Mar 29, 2005 at 04:36:42PM +0300, Boris wrote:
>
>> Robert Ramey wrote:
>>> Windows has the concept of "Overlapped I/O" which permits dispatch
>>> of an i/o request that invokes a call back when done.
>>>
>>> Posix has aio which functions (I believe) in a similar way.
>>>
>>> So one has the concept of asyncronous i/o without any explicit
>>> reference to threads at least at the application level.
>>
>> I am not sure if I understand correctly. Just as Don I think we
>> can't get around threads when we have callbacks. I don't know about
>> Windows but the callback in aio (Posix) is done by creating a new
>> thread.
>
> How the kernel chooses to implement the aio system calls is an
> implementation detail - it certainly doesn't require use of
> Boost.Thread types! I think what Robert was saying is that an
> application can use
> POSIX aio without ever having to use or know about POSIX threads.

But the application programmer still must understand that the callback
function is executed as a thread as otherwise he could mess up everything if
he believes his application is single-threaded.

> You and Don seem to be requiring that the application explicitly
> create
> and manage threads. Several people have suggested they'd like to use
> some form of AIO without having to use threads.

I think Don and me were talking about callbacks where we think they can't be
implemented without threads. However I don't mind if the library creates and
manages threads. If we don't use threads for callbacks the one and only
thread in the application has to wait or poll - this is possible eg. in .NET
which is very flexible about asynchronous operations (see
http://blogs.msdn.com/cbrumme/archive/2003/05/06/51385.aspx). However if you
want to wait or poll you don't use an asynchronous model at all but just do
non-blocking calls or block in a select() (multiplexing model). Maybe the
confusion comes from that I have a network library in mind and others think
about asynchronicity in general?

Boris


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk