@@ -870,13 +870,15 @@ module AsyncPrimitives =
870870 /// - Create Thread and call Start() with exception protection. We don't expect this
871871 /// to fail but protect nevertheless.
872872 let CreateSwitchToNewThreadAsync () =
873- MakeAsyncWithCancelCheck( fun ctxt -> ctxt.ProtectCode( fun () -> ctxt.trampolineHolder.StartThreadWithTrampoline ctxt.cont))
873+ MakeAsyncWithCancelCheck( fun ctxt ->
874+ ctxt.ProtectCode( fun () -> ctxt.trampolineHolder.StartThreadWithTrampoline ctxt.cont))
874875
875876 /// - Initial cancellation check
876877 /// - Call ThreadPool.QueueUserWorkItem with exception protection. We don't expect this
877878 /// to fail but protect nevertheless.
878879 let CreateSwitchToThreadPoolAsync () =
879- MakeAsyncWithCancelCheck( fun ctxt -> ctxt.ProtectCode( fun () -> ctxt.trampolineHolder.QueueWorkItemWithTrampoline ctxt.cont))
880+ MakeAsyncWithCancelCheck( fun ctxt ->
881+ ctxt.ProtectCode( fun () -> ctxt.trampolineHolder.QueueWorkItemWithTrampoline ctxt.cont))
880882
881883 /// Post back to the sync context regardless of which continuation is taken
882884 /// - Call syncCtxt.Post with exception protection
@@ -917,7 +919,8 @@ module AsyncPrimitives =
917919 // This logic was added in F# 2.0 though is incorrect from the perspective of
918920 // how SynchronizationContext is meant to work. However the logic works for
919921 // mainline scenarios (WinForms/WPF) and for compatibility reasons we won't change it.
920- | _ when Object.Equals( syncCtxt, currentSyncCtxt) && thread.Equals Thread.CurrentThread -> executeImmediately ()
922+ | _ when Object.Equals( syncCtxt, currentSyncCtxt) && thread.Equals Thread.CurrentThread ->
923+ executeImmediately ()
921924 | _ -> trampolineHolder.PostOrQueueWithTrampoline syncCtxt action
922925
923926 member _.PostOrQueueWithTrampoline res =
@@ -1074,7 +1077,7 @@ module AsyncPrimitives =
10741077 ( typeof< FuncDelegate< 'T>>)
10751078 .GetMethod( " Invoke" , BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.Instance)
10761079
1077- System. Delegate.CreateDelegate( typeof< 'Delegate>, obj, invokeMeth) :?> 'Delegate
1080+ Delegate.CreateDelegate( typeof< 'Delegate>, obj, invokeMeth) :?> 'Delegate
10781081
10791082 [<DebuggerHidden>]
10801083 let QueueAsync cancellationToken cont econt ccont computation =
@@ -1429,7 +1432,9 @@ type Async =
14291432 static member CancelCheck () =
14301433 unitAsync
14311434
1432- static member FromContinuations ( callback : ( 'T -> unit ) * ( exn -> unit ) * ( OperationCanceledException -> unit ) -> unit ) : Async < 'T > =
1435+ static member FromContinuations
1436+ ( callback : ( 'T -> unit ) * ( exn -> unit ) * ( OperationCanceledException -> unit ) -> unit )
1437+ : Async < 'T > =
14331438 MakeAsyncWithCancelCheck( fun ctxt ->
14341439 let mutable underCurrentThreadStack = true
14351440 let mutable contToTailCall = None
@@ -1451,7 +1456,11 @@ type Async =
14511456 ctxt.trampolineHolder.ExecuteWithTrampoline( fun () -> cont x) |> unfake
14521457
14531458 try
1454- callback ( once ctxt.cont, ( fun exn -> once ctxt.econt ( ExceptionDispatchInfo.RestoreOrCapture exn)), once ctxt.ccont)
1459+ callback (
1460+ once ctxt.cont,
1461+ ( fun exn -> once ctxt.econt ( ExceptionDispatchInfo.RestoreOrCapture exn)),
1462+ once ctxt.ccont
1463+ )
14551464 with exn ->
14561465 if not ( latch.Enter()) then
14571466 invalidOp ( SR.GetString( SR.controlContinuationInvokedMultipleTimes))
@@ -1518,7 +1527,12 @@ type Async =
15181527 static member Parallel ( computations : seq < Async < 'T >>, ? maxDegreeOfParallelism : int ) =
15191528 match maxDegreeOfParallelism with
15201529 | Some x when x < 1 ->
1521- raise ( System.ArgumentException( String.Format( SR.GetString( SR.maxDegreeOfParallelismNotPositive), x), " maxDegreeOfParallelism" ))
1530+ raise (
1531+ System.ArgumentException(
1532+ String.Format( SR.GetString( SR.maxDegreeOfParallelismNotPositive), x),
1533+ " maxDegreeOfParallelism"
1534+ )
1535+ )
15221536 | _ -> ()
15231537
15241538 MakeAsyncWithCancelCheck( fun ctxt ->
@@ -1547,8 +1561,10 @@ type Async =
15471561
15481562 match firstExn with
15491563 | None -> ctxt.trampolineHolder.ExecuteWithTrampoline( fun () -> ctxt.cont results)
1550- | Some ( Choice1Of2 exn) -> ctxt.trampolineHolder.ExecuteWithTrampoline( fun () -> ctxt.econt exn)
1551- | Some ( Choice2Of2 cexn) -> ctxt.trampolineHolder.ExecuteWithTrampoline( fun () -> ctxt.ccont cexn)
1564+ | Some ( Choice1Of2 exn) ->
1565+ ctxt.trampolineHolder.ExecuteWithTrampoline( fun () -> ctxt.econt exn)
1566+ | Some ( Choice2Of2 cexn) ->
1567+ ctxt.trampolineHolder.ExecuteWithTrampoline( fun () -> ctxt.ccont cexn)
15521568 else
15531569 fake ()
15541570
@@ -1724,7 +1740,12 @@ type Async =
17241740 let cancellationToken =
17251741 defaultArg cancellationToken defaultCancellationTokenSource.Token
17261742
1727- AsyncPrimitives.StartWithContinuations cancellationToken computation continuation exceptionContinuation cancellationContinuation
1743+ AsyncPrimitives.StartWithContinuations
1744+ cancellationToken
1745+ computation
1746+ continuation
1747+ exceptionContinuation
1748+ cancellationContinuation
17281749
17291750 static member StartWithContinuations
17301751 (
@@ -1781,7 +1802,8 @@ type Async =
17811802 DisposeCancellationRegistration & registration
17821803 DisposeTimer & timer
17831804
1784- ctxt.trampolineHolder.ExecuteWithTrampoline( fun () -> ctxt.ccont ( OperationCanceledException( ctxt.token)))
1805+ ctxt.trampolineHolder.ExecuteWithTrampoline( fun () ->
1806+ ctxt.ccont ( OperationCanceledException( ctxt.token)))
17851807 |> unfake)
17861808 )
17871809 |> Some
@@ -1847,7 +1869,8 @@ type Async =
18471869 UnregisterWaitHandle & rwh
18481870
18491871 // Call the cancellation continuation
1850- ctxt.trampolineHolder.ExecuteWithTrampoline( fun () -> ctxt.ccont ( OperationCanceledException( ctxt.token)))
1872+ ctxt.trampolineHolder.ExecuteWithTrampoline( fun () ->
1873+ ctxt.ccont ( OperationCanceledException( ctxt.token)))
18511874 |> unfake)
18521875 )
18531876 |> Some
@@ -1929,7 +1952,11 @@ type Async =
19291952 let res = resultCell.GrabResult()
19301953 return res.Commit()
19311954 else
1932- let! ok = Async.AwaitWaitHandle( resultCell.GetWaitHandle(), ?millisecondsTimeout = millisecondsTimeout)
1955+ let! ok =
1956+ Async.AwaitWaitHandle(
1957+ resultCell.GetWaitHandle(),
1958+ ?millisecondsTimeout = millisecondsTimeout
1959+ )
19331960
19341961 if ok then
19351962 let res = resultCell.GrabResult()
@@ -2009,10 +2036,18 @@ type Async =
20092036 Async.FromBeginEnd(( fun ( iar , state ) -> beginAction ( arg, iar, state)), endAction, ?cancelAction = cancelAction)
20102037
20112038 static member FromBeginEnd ( arg1 , arg2 , beginAction , endAction , ? cancelAction ) : Async < 'T > =
2012- Async.FromBeginEnd(( fun ( iar , state ) -> beginAction ( arg1, arg2, iar, state)), endAction, ?cancelAction = cancelAction)
2039+ Async.FromBeginEnd(
2040+ ( fun ( iar , state ) -> beginAction ( arg1, arg2, iar, state)),
2041+ endAction,
2042+ ?cancelAction = cancelAction
2043+ )
20132044
20142045 static member FromBeginEnd ( arg1 , arg2 , arg3 , beginAction , endAction , ? cancelAction ) : Async < 'T > =
2015- Async.FromBeginEnd(( fun ( iar , state ) -> beginAction ( arg1, arg2, arg3, iar, state)), endAction, ?cancelAction = cancelAction)
2046+ Async.FromBeginEnd(
2047+ ( fun ( iar , state ) -> beginAction ( arg1, arg2, arg3, iar, state)),
2048+ endAction,
2049+ ?cancelAction = cancelAction
2050+ )
20162051
20172052 static member AsBeginEnd < 'Arg , 'T >
20182053 ( computation : ( 'Arg -> Async < 'T >))
@@ -2267,7 +2302,9 @@ module WebExtensions =
22672302 )
22682303 |> CreateTryWithFilterAsync( fun exn ->
22692304 match exn with
2270- | :? System.Net.WebException as webExn when webExn.Status = System.Net.WebExceptionStatus.RequestCanceled && canceled ->
2305+ | :? System.Net.WebException as webExn when
2306+ webExn.Status = System.Net.WebExceptionStatus.RequestCanceled && canceled
2307+ ->
22712308
22722309 Some( CreateAsyncResultAsync( AsyncResult.Canceled( OperationCanceledException webExn.Message)))
22732310 | _ -> None)
0 commit comments