Skip to content

Commit c78fd63

Browse files
authored
Cleanup whileasync (#44)
* cleanup whileasync * WIP * Move whileasync priority * Fix tfms * ensure source members have distinct overloads * delete playground * delete playground
1 parent 4a903d9 commit c78fd63

File tree

11 files changed

+280
-463
lines changed

11 files changed

+280
-463
lines changed

Directory.Build.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,9 @@
1010
<!-- owners is not supported in MSBuild -->
1111
<OtherFlags>$(OtherFlags) --test:GraphBasedChecking --test:ParallelIlxGen --test:ParallelOptimization </OtherFlags>
1212
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
13+
<!--
14+
* FS3517 InlineIfLambda didn't get inlined
15+
-->
16+
<!-- <WarnOn>$(WarnOn);3517</WarnOn> -->
1317
</PropertyGroup>
1418
</Project>

docsSrc/index.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ AsyncEx is similar to Async except in the following ways:
6363
```
6464
3. When Tasks throw exceptions they will use the behavior described in [Async.Await overload (esp. AwaitTask without throwing AggregateException](https://github.com/fsharp/fslang-suggestions/issues/840)
6565
66-
6766
```fsharp
6867
let data = "lol"
6968
@@ -89,10 +88,8 @@ AsyncEx is similar to Async except in the following ways:
8988
return raise (Exception("Should not throw this type of exception", ex))
9089
}
9190
```
92-
9391
4. Use [IAsyncEnumerable](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.iasyncenumerable-1?view=net-8.0) with `for` keyword. This example uses [TaskSeq](https://github.com/fsprojects/FSharp.Control.TaskSeq) but you can use any `IAsyncEnumerable<T>`.
9492
95-
9693
```fsharp
9794
open IcedTasks
9895
open FSharp.Control

msbuild.binlog

1.28 MB
Binary file not shown.

src/IcedTasks/CancellableTaskBuilderBase.fs

Lines changed: 126 additions & 208 deletions
Large diffs are not rendered by default.

src/IcedTasks/TaskBuilderBase.fs

Lines changed: 137 additions & 239 deletions
Large diffs are not rendered by default.

tests/IcedTasks.Tests/CancellablePoolingValueTaskTests.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ module CancellablePoolingValueTaskTests =
805805

806806
let! actual =
807807
cancellablePoolingValueTask {
808-
for (i: int) in asyncSeq do
808+
for i in asyncSeq do
809809
do! Task.Yield()
810810
index <- i + i
811811

@@ -967,10 +967,10 @@ module CancellablePoolingValueTaskTests =
967967

968968
let doOtherStuff (l: ResizeArray<_>) x =
969969
cancellablePoolingValueTask {
970-
l.Add(x)
970+
lock l (fun () -> l.Add(x))
971971
do! Task.yieldMany 1000
972972
let dt = DateTimeOffset.UtcNow
973-
l.Add(x)
973+
lock l (fun () -> l.Add(x))
974974
return dt
975975
}
976976

tests/IcedTasks.Tests/CancellableTaskTests.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -926,10 +926,10 @@ module CancellableTaskTests =
926926

927927
let doOtherStuff (l: ResizeArray<_>) x =
928928
cancellableTask {
929-
l.Add(x)
929+
lock l (fun () -> l.Add(x))
930930
do! Task.yieldMany 1000
931931
let dt = DateTimeOffset.UtcNow
932-
l.Add(x)
932+
lock l (fun () -> l.Add(x))
933933
return dt
934934
}
935935

tests/IcedTasks.Tests/CancellableValueTaskTests.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -963,10 +963,10 @@ module CancellableValueTaskTests =
963963

964964
let doOtherStuff (l: ResizeArray<_>) x =
965965
cancellableValueTask {
966-
l.Add(x)
966+
lock l (fun () -> l.Add(x))
967967
do! Task.yieldMany 1000
968968
let dt = DateTimeOffset.UtcNow
969-
l.Add(x)
969+
lock l (fun () -> l.Add(x))
970970
return dt
971971
}
972972

tests/IcedTasks.Tests/PoolingValueTaskTests.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,10 +690,10 @@ module PoolingValueTaskTests =
690690

691691
let doOtherStuff (l: ResizeArray<_>) x =
692692
poolingValueTask {
693-
l.Add(x)
693+
lock l (fun () -> l.Add(x))
694694
do! Task.yieldMany 1000
695695
let dt = DateTimeOffset.UtcNow
696-
l.Add(x)
696+
lock l (fun () -> l.Add(x))
697697
return dt
698698
}
699699

tests/IcedTasks.Tests/TaskTests.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,10 +693,10 @@ module TaskTests =
693693

694694
let doOtherStuff (l: ResizeArray<_>) x =
695695
task {
696-
l.Add(x)
696+
lock l (fun () -> l.Add(x))
697697
do! Task.yieldMany 1000
698698
let dt = DateTimeOffset.UtcNow
699-
l.Add(x)
699+
lock l (fun () -> l.Add(x))
700700
return dt
701701
}
702702

0 commit comments

Comments
 (0)