[Mono-dev] Opinion? On potential fix for a 6 year old bug....

Rob Wilkens robwilkens at gmail.com
Sat Jun 2 01:28:20 UTC 2012

I've come up with as close to a good fix for Novell #321541 as I could 
think of, and it works for the sample code provided in the bug report.  
Ignore my comments on that report, i originally looked at the problem 
wrong, and made some incorrect statements --  I haven't posted anything 
current there.

Specifically: Bug Report: Application.Idle is sent to all threads 
instead of just one.

Fix I have: I created an array of 101 [0 to 100] event handlers 
(changeable by a const), which is indexed by 
thread.currentthread.managedthreadid .. When each particular thread 
would call the idle event handler, it now calls an indexed idle event 
handler instead.  Also, since i limited it to ~100 thread id's, if the 
thread id is greater than 100, it assigns it to thread 1, which from 
what i can tell is always the main thread.  So if the Idle handler is 
added by thread 1, only thread 1 will call it, if it's added by thread 
3, only thread 3 will call it.  IF it's added by thread 101, however, it 
will fallback to calling that idle handler for thread 1 only which is 
better than the current practice of delivering each idle event to all 

Issues I have questions with:
(1) I have only tested with X11, but i had to modify the other drivers 
slightly so that they call the thread indexed idle handlers.  I am 
confident that if it works for X11 it will work for other drivers, 
because it doesn't change anything with interfacing, just message 
processing.  Can I submit this without testing on every possible 
platform?  If the suggestion is to submit it and see what happens, i'm 
ok with that.

(2) I know an array isn't the most wonderful way to handle this, but i 
couldn't figure out how to otherwise assign an event handler to, for 
example, a hashtable entry.  Perhaps I'm just stupid, but i think the 
problem is that an EventHandler property, for example, doesn't have a 
Get and Set, instead it has an Add and Remove.  I couldn't find any 
examples of this being done to model this on.  Any opinions on this?

I'll try to sit on this until at least late tomorrow at minimum...  If 
anyone is willing to tell me "go ahead and submit the 
commit/push/pull-request, and let someone review it", let me know.  If I 
don't hear anything, that's probably what i'll do anyway.

Oh, For convenience, here is the bug report link:


More information about the Mono-devel-list mailing list