[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

Clearing event queues

greg

2/19/2008 9:33:00 PM

Is it possible to clear event queues?

I have a bug that is occuring and I've narrowed it down to events being
queued up.


Thanks,
Greg
4 Answers

Jeroen Mostert

2/19/2008 9:45:00 PM

0

greg wrote:
> Is it possible to clear event queues?
>
Depends on what you mean by "event queues". Do you mean .NET events being
fired, a la

public event MyEventDelegate MyEvent;
MyEvent(myEventArgs);

? Or perhaps Windows messages generated from user interaction?

> I have a bug that is occuring and I've narrowed it down to events being
> queued up.
>
If you're talking about .NET events, they are not queued. All event handlers
are executed sequentially when an event fires. If a handler hangs, all other
handlers in the chain (and the event processing itself) will hang too, which
might be what you're observing.

Event handlers may also be invoked asynchronously, with .BeginInvoke().
Those require a free threadpool thread to execute, and if one is not
available (which might happen if there are many asynchronous invocations and
handlers are very slow) the invocation will stall until one is available
(but the code invoking the event will still continue).

Other than that, more details would be required about your problem.

--
J.

v-lliu

2/20/2008 7:28:00 AM

0

Hi Greg,

What the events do you refer to? Are they .NET events?

IMO, it may not possible to clear event queues. But we can prevent event
handlers to be called when an event is fired.

Would you please provide us more details about your problem? Then it's
possible for us to give you more helpful suggestion.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default....
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/de....
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

greg

2/20/2008 2:16:00 PM

0

Thank you both for your replies.

I've found a workaround for now, it involves the ItemChecked in a ListView.

I was pulling values from a database row to set which items were selected in
a ListView when you went to modify this row. For some reason, after selecting
all those items (anItem.Checked = true;), when I re-enabled the ItemChecked
handler, it would get called for some reason, even though I was finished all
of the item checking. I would step through each .Checked=true; with the
debugger. I finished that portion of code, got to the portion where I
re-enabled the handler, and then all of a sudden the next step I would fnid
myself inside that event handler, when nothing has happened to cause it to
trigger.

What I've done is a work around by some intense googling :) I have a
MouseDown event which sets a boolean to true. The ItemChecked event checks
for this boolean and exits if it is false. That way when this event is
mysteriously called as mentioned above, it simply returns.

v-lliu

2/22/2008 10:59:00 AM

0

Hi Greg,

I'm glad to hear that you have solved the problem and thank you for sharing
with us how you solved the problem sucessfully. I think it will definitely
benefit all of us!

If you have any other questions in the future, please don't hesitate to
contact us. It's always our pleasure to be of assistance!

Have a nice weekend!

Sincerely,
Linda Liu
Microsoft Online Community Support