|
Boost : |
From: Don G (dongryphon_at_[hidden])
Date: 2005-03-23 23:34:26
Hi Hans, Robert and Patrick,
My comments are below.
Hans Malherbe wrote:
> The main thread does the waiting.
>
> In Windows NT you will either wait on the event flag
> in the OVERLAPPED structure or specify a completion
> routine and wait in an alertable state with the
> SleepEx or one of the *WaitFor*ObjectsEx functions.
That makes sense, and I have used that feature before. The hard part
about putting this technique to use in a library is that it makes
requirements on the behavior of main: it must be in an alertable
wait. If I recall correctly, GetMessage/PeekMessage are not
alertable.
Robert Ramey wrote:
> Windows has the concept of "Overlapped I/O" which
> permits dispatch of an i/o request that invokes a
> callback 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.
Yes, you are correct; this is a terminology challenged area for
me<g>! In this case as well as the above, the application has to wait
for completion in the correct manner - not so good for a library
IMHO.
Patrick Mézard wrote:
> By the way, there were and will be lengthy
> discussions about which approach is the "best" to
> build scalable concurrent programs. I think that
> multithreading and event-driven programming were
> proven to be equivalent from a theorical point of
> view, but there real differences in implementation.
It's so hard to find the "best" isn't it? :) Of course, there is
seldom a consistent "best" even when an objective measure can be
produced (which is almost never) because the result depends so
greatly on the scenario or use case.
Perhaps the key ingrediant to "best" is "widely used" or "commonly
accepted". If you pause to think about it, a standard technique (that
wasn't gratuitously inefficient) that everyone could just use would
be better (IMHO) than a more optimized, but niche/non-portable
technique.
Thanks all!
Don
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk