[Mono-bugs] [Bug 81740][Blo] Changed - Bugs in the use of tailcalls and in the System.Threading.SynchronizationContext.Current
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Sat May 26 06:16:49 EDT 2007
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by s.guido at email.it.
http://bugzilla.ximian.com/show_bug.cgi?id=81740
--- shadow/81740 2007-05-26 06:13:38.000000000 -0400
+++ shadow/81740.tmp.15483 2007-05-26 06:16:49.000000000 -0400
@@ -2,13 +2,13 @@
Product: Mono: Runtime
Version: 1.2
OS: All
OS Details: all; ms Vista/Xp, Linux os
Status: NEW
Resolution:
-Severity:
+Severity: Unknown
Priority: Blocker
Component: misc
AssignedTo: mono-bugs at ximian.com
ReportedBy: s.guido at email.it
QAContact: mono-bugs at ximian.com
TargetMilestone: ---
@@ -109,6 +109,60 @@
Guido Scatena
------- Additional Comments From s.guido at email.it 2007-05-26 06:13 -------
Created an attachment (id=19326)
Visual Studio 2005 Project - all source and the executable that cause bug
+
+------- Additional Comments From s.guido at email.it 2007-05-26 06:16 -------
+the main problem occur in this code (located in worker.fs)
+
+ // Capture the synchronization context of the thread that creates
+this object. This
+ // allows us to send messages back to the GUI thread painlessly.
+ let callerCtxt = SynchronizationContext.Current
+ let runInCallerCtxt f = callerCtxt.Post((fun _ -> f()),null)
+
+...
+
+ /// This is the States of the worker's automata using a set of
+ /// tail-calling recursive functions.
+ let rec ResetThen f s =
+ Init()
+ f(s)
+
+ and Running(s) =
+ peek (function
+ | Pause -> Paused s
+ | Step -> Running s
+ | Run -> Running s
+ | Reset -> ResetThen Running s
+ | Exit -> Finish s)
+ (fun () -> StepThen (SleepThen Running) s)
+
+ and StepThen f s =
+ let s,conc = oneStep(s,10)
+ if not (((*fst( *)conc) = float (-1)) then f s
+ else FinishEarly(s)
+
+ and SleepThen f s =
+ // A pause between steps of the computation is needed to
+ // give a decent response from the GUI menus.
+ //if data_refresh_rate < 100 then
+Thread.Sleep(2/data_refresh_rate) |> ignore
+ f(s)
+
+ and Paused(s) =
+ wait (function
+ | Pause -> Paused s
+ | Step -> StepThen Paused s
+ | Run -> Running s
+ | Reset -> ResetThen Paused s
+ | Exit -> Finish s)
+ and FinishEarly(s) =
+ runInCallerCtxt(fun _ -> fireFinishedEarly())
+ Paused(s)
+ and Finish(s) = s
+
+ /// This is the function that each worker thread ultimately runs
+ let start = ResetThen Running
+
More information about the mono-bugs
mailing list