File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Control Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -294,6 +294,26 @@ type AsyncModule() =
294294 member this. ``RaceBetweenCancellationAndError.Sleep`` () =
295295 testErrorAndCancelRace ( Async.Sleep (- 5 ))
296296
297+
298+ [<Test>]
299+ member this. ``error on one workflow should cancel all others`` () =
300+ let counter =
301+ async {
302+ let counter = ref 0
303+ let job i = async {
304+ if i = 55 then failwith " boom"
305+ else
306+ do ! Async.Sleep 1000
307+ incr counter
308+ }
309+
310+ let! _ = Async.Parallel [ for i in 1 .. 100 -> job i ] |> Async.Catch
311+ do ! Async.Sleep 5000
312+ return ! counter
313+ } |> Async.RunSynchronously
314+
315+ Assert.AreEqual( 0 , counter)
316+
297317 [<Test>]
298318 member this. ``AwaitWaitHandle.ExceptionsAfterTimeout`` () =
299319 let wh = new System.Threading.ManualResetEvent( false )
Original file line number Diff line number Diff line change @@ -1414,8 +1414,7 @@ namespace Microsoft.FSharp.Control
14141414 let count = ref tasks.Length
14151415 let firstExn = ref None
14161416 let results = Array.zeroCreate tasks.Length
1417- // Attept to cancel the individual operations if an exception happens on any the other threads
1418- //let failureCTS = new CancellationTokenSource()
1417+ // Attept to cancel the individual operations if an exception happens on any of the other threads
14191418 let innerCTS = new LinkedSubSource( aux.token)
14201419 let trampolineHolder = aux.trampolineHolder
14211420
You can’t perform that action at this time.
0 commit comments