Re: How to PostThreadMessages?
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Wed, 06 Jun 2007 01:13:34 -0400
It is essential that if you are using WinCE that you state so explicitly; there is no
reason to assume that this is what is being used, and the assumption is that unless you
explicitly state you are using WinCE that you are using a version of Windows no less
capable than Win2K, and more likely WinXP or even Vista.
However, the sad truth is that you still cannot put an infinite loop in a UI thread
because it merely cripples the key feature that make it a UI thread, that is, the message
pump. Once you have an infinite loop, you have no reason to have a UI thread. Once the
loop is entered, there can never be another message handled; not a timer message, not any
other message.
However, SetCommTimeouts seems to be a reasonable substitute for asynchronous I/O for
ReadFile. So ReadFile would essentiallly behave in a fashion consistent with asynchronous
I/O. Since my output thread would work well with synchronous output (except for the
shutdown issue), only a slight variation of that code would be required. The key here is
that you can't indefinitely block a UI thread. If, for example, a WriteFile wrote one
byte, with a timeout set by SetCommTimeouts, much of the effect of having asynchronous I/O
should be available, although a bit clumsier. So if the serial port got blocked for some
long period, the timeout would allow the ability to poll the shutdown boolean (rather than
using a shutdown event)
So this goes back to basic understanding issue of threading and asynchronous I/O, even if
the asynchronous I/O is performed by mechanisms somewhat more complex than
FILE_FLAG_OVERLAPPED.
joe
On Tue, 5 Jun 2007 13:29:09 -0500, "jp2code" <poojo.com/mail> wrote:
"Joseph M. Newcomer" wrote...Joseph M. Newcomer [MVP]
I fail to see why you cannot use asynchronous data transfer; there is no
reason this would
not work.
WinCE / PocketPC
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- References:
- How to PostThreadMessages?
- From: jp2code
- Re: How to PostThreadMessages?
- From: Joseph M . Newcomer
- Re: How to PostThreadMessages?
- From: jp2code
- Re: How to PostThreadMessages?
- From: Joseph M . Newcomer
- Re: How to PostThreadMessages?
- From: jp2code
- How to PostThreadMessages?
- Prev by Date: Re: How to catch WM_PAINT use Hook in Dialog?
- Next by Date: Re: How to PostThreadMessages?
- Previous by thread: Re: How to PostThreadMessages?
- Next by thread: Re: How to PostThreadMessages?
- Index(es):
Relevant Pages
|