launching on Wintel/inter-process communication

Larry_R_Huisingh at rl.gov Larry_R_Huisingh at rl.gov
Tue Dec 3 13:08:01 EST 2002


> One question remains unanswered:  Why the stigma against polling?  I mean,
> of course it's suboptimal compared to event-driven mechanisms like Apple
> events, but in the absence of a supported event mechanism is polling
really
> so very bad? 
> 

Polling isn't necessarily so bad.  I have to think that even for methods
that don't appear to be polling-based there would ultimately have to be some
sort of polling going on in the background perhaps even at the hardware
level.  Also, polling isn't so bad if it doesn't extract much of a
performance penalty.  If a poll takes just one millisecond every second then
you're not losing much.  It may be a little clumsier looking than some
event-based methods but sometimes polling methods are easier to understand
and debug.  

Actually, with MC, polling can be clean and very easy to implement via the
"send" command.  At the beginning of your program you "send" a message that
will execute in 1 second.  Set up a handler for that message to do the poll
and at the end of that routine issue a send of that same message for another
second later.  That way the handler sets up the next poll.  The main
routines don't ever have to have polling in their loops.  

Best of luck.

Larry Huisingh



More information about the metacard mailing list