The problem is that if you say that most of the windows form's evens are
queued. One could think "If I raise and event in a class thet derives from
Control class it will be queued" or "Hey, if Windows Form's guys can queue
an event I should be able to do that as well"
that would be true, in a sense. if you post several messages to a class that
derives from Control, these messages will be queued and the Control will
respond by raising a sequence of events.
There is no such a thing as queued event unless one uses PInvoke and windows
messages. Even using control.BeginInvoke is not the same as posting a
message because the event will be the next thing executed while posted
message will wait in the message queue its time to be processed.
that's absolutely true and I am not confused. but depending on from which
side you look at it and start to talk about it, it can sound differently.
look at the original question:
"Are events in winforms blocking or non-blocking? In other words, when an
event is raised - is it added to a queue or are you blocked until it
finishes executing?"
there are in fact two issues there.
"Are events in winforms blocking"?
yes, they are. the event handler blocks the execution and nothing else
happens until it finishes.
"when an event is raised - is it added to a queue or are you blocked until
it
finishes executing"
the "OR" here does not make sense. because the truth is: winforms events are
not queued but corresponding win32 messages are. so, there's no queue of
pending events available to winforms developer but when you peek deeply
under the cover, the win32 messages are there, perfectly queued.
And why sould we make such a simple thing as event complex. Events are not
queued.
If you now say that events are not queued then one could think: "if an
winforms event is handled and other events occur before it finishes then
these other events are gone, since there's no queue to store them". how do
you like it?
Wiktor