[Mono-bugs] [Bug 653928] From thread-pool thread, QueueUserWorkItem schedules onto the same thread

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Nov 16 22:11:30 EST 2010



Gonzalo Paniagua Javier <gonzalo at novell.com> changed:

           What    |Removed                     |Added
                 CC|                            |gonzalo at novell.com
         AssignedTo|mono-bugs at lists.ximian.com  |gonzalo at novell.com

--- Comment #4 from Gonzalo Paniagua Javier <gonzalo at novell.com> 2010-11-17 03:11:29 UTC ---
Our threadpool in 2.8 and above behaves more like the .NET 4.0 threadpool. Each
thread has a local queue (work-stealing queue) from which other threadpool
threads might steal work items when they are idle.

This also means that the order of execution is not (quasi-)guaranteed as it was
before and that it is possible that everything you queue from a threadpool
thread is executed from the same thread (only under special circumstances: the
work items don't take too long, other threadpool threads are busy).

Now, given that you see this problem with Mono on windows, I'd like to test
that and see if it's a windows-only problem. How many CPU cores does your
machine have?

In my machine with Mono on linux, in the first try:
 [TID: 1]
* SimpleTestOuterQuwiInnerQuwi
114342410: Calling QueueUserWorkItem(outer)
114342419: Outer: calling QueueUserWorkItem(inner)  [TID: 2]
114342419: Outer: pausing...
114342519:     Inner: Was I called only **after** Outer exited??????  [TID: 3]
114344419: Outer: exiting...
* SimpleTest
114346420: Calling outer.BeginInvoke
114346421: Outer: calling inner.BeginInvoke  [TID: 3]
114346421: Outer: pausing...
114346421:     Inner: Was I called only **after** Outer exited??????  [TID: 2]
114348421: Outer: exiting...
* SimpleTestOuterQuwi
114350422: Calling QueueUserWorkItem(outer)
114350422: Outer: calling inner.BeginInvoke  [TID: 3]
114350422: Outer: pausing...
114350422:     Inner: Was I called only **after** Outer exited??????  [TID: 2]
114352422: Outer: exiting...

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