|
Posted by Fred on February 2, 2006, 2:48 pm
Please log in for more thread options
>
> > Fred,
> >
> > Let's discuss what your old book says:
> >
> > "The async mode is most suited to applications which must be single
> threaded
> > and stay responsive to the end user and in extreme performance and
memory
> > sensitive situations"
> >
> > This is technically true, but don't be misled by it!
> >
> > If an application must be single threaded, then synchronous mode by
> > definition will prevent it from returning to the message loop until it
is
> > done. However, there is no such application in practice. Who's stopping
> you
> > from using multiple threads? Nobody! Only your own lack of knowledge
about
> > multithreaded programming, perhaps.
>
> Yes as far as synchronous/asynchronous Wininet and multithreading is
> concerned.
> I have written a pretty complicated prog with a thread pool and
synchronous
> Wininet and it works - but I'm still not happy about cancelling threads
when
> we have a timed-out block.
>
> > The rest of it is presumably talking about the expense of creating a
> thread.
> > It takes a little time and it allocates some memory (the largest part of
> > which is the stack). However, these are not really relevant issues for
> most
> > applications. You're not going to be downloading thousands of web pages
at
> > once are you?
>
> What is the extra complexity involved in writing asynch wininet?
>
> MS's asyncdemo doesn't look too bad
>
>
http://msdn.microsoft.com/library/en-us/wininet/wininet/calling_wininet_functions_asynchronously.asp
>
Incidentally it also uses threads!!!!!!
|