[Mono-bugs] [Bug 321541] Application.Idle called once per thread instead of 1 time only

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Jun 2 01:30:33 UTC 2012



--- Comment #9 from Robert Wilkens <robwilkens at gmail.com> 2012-06-02 01:30:29 UTC ---
I posted information on my potential fix for this tonight on the mono-devel
list, i thought it wise to copy here.

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 threads.

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:

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list