https://bugzilla.novell.com/show_bug.cgi?id=653928
https://bugzilla.novell.com/show_bug.cgi?id=653928#c0 Summary: Delegate.BeginInvoke from thread-pool thread does NOT run until it exits Classification: Mono Product: Mono: Runtime Version: 2.8.x Platform: x86 OS/Version: Windows XP Status: NEW Severity: Normal Priority: P5 - None Component: misc AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- Created an attachment (id=400473) --> (http://bugzilla.novell.com/attachment.cgi?id=400473) C# code file containing repro code as described. User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E) Tested in 2.8 (release). Only tested on WinXP. If Delegate.BeginInvoke is called from a thread-pool thread then the target delegate method is *only* run *after* the original thread-pool thread exits. (I can't really I'm seeing this but its 100% reproducible...) With the code sample at the bottom we see the following. * On MSFT and on Mono 2.6.3 (e.g.): [[ 223240953: Calling outer.BeginInvoke 223240953: Outer: calling inner.BeginInvoke 223240953: Outer: pausing... 223240953: Inner: Was I called only **after** Outer exited?????? 223242953: Outer: exiting... ]] * But on Mono 2.8 we see: :-( [[ 223244187: Calling outer.BeginInvoke 223244390: Outer: calling inner.BeginInvoke 223244390: Outer: pausing... 223246390: Outer: exiting... 223246390: Inner: Was I called only **after** Outer exited?????? ]] Note the second BeginInvoke does NOT run until the first thread-pool method exits. (Note the same occurs if ThreadPool.QueueUserWorkItem is used to run the 'outer' method, so its not a problem with BeginInvoke within BeginInvoke). Code sample, (full code attached): [[ static void SimpleTest() { int msForOuterToDelay = 2000; // WaitCallback inner = delegate { Console_WriteLine(" Inner: Was I called only **after** Outer exited??????"); }; // WaitCallback outer = delegate { Console_WriteLine("Outer: calling inner.BeginInvoke"); var arI = inner.BeginInvoke(null, null, null); // Console_WriteLine("Outer: pausing..."); Thread.Sleep(msForOuterToDelay); Console_WriteLine("Outer: exiting..."); }; // Console_WriteLine("Calling outer.BeginInvoke"); var arO = outer.BeginInvoke(null, null, null); // Thread.Sleep(msForOuterToDelay); Thread.Sleep(msForOuterToDelay); } ]] Reproducible: Always Steps to Reproduce: See attached code sample. -- 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. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
