Skip to content

Commit

Permalink
Cleanup whileasync (#44)
Browse files Browse the repository at this point in the history
* cleanup whileasync

* WIP

* Move whileasync priority

* Fix tfms

* ensure source members have distinct overloads

* delete playground

* delete playground
  • Loading branch information
TheAngryByrd authored Apr 6, 2024
1 parent 4a903d9 commit c78fd63
Show file tree
Hide file tree
Showing 11 changed files with 280 additions and 463 deletions.
4 changes: 4 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@
<!-- owners is not supported in MSBuild -->
<OtherFlags>$(OtherFlags) --test:GraphBasedChecking --test:ParallelIlxGen --test:ParallelOptimization </OtherFlags>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<!--
* FS3517 InlineIfLambda didn't get inlined
-->
<!-- <WarnOn>$(WarnOn);3517</WarnOn> -->
</PropertyGroup>
</Project>
3 changes: 0 additions & 3 deletions docsSrc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ AsyncEx is similar to Async except in the following ways:
```
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)
```fsharp
let data = "lol"
Expand All @@ -89,10 +88,8 @@ AsyncEx is similar to Async except in the following ways:
return raise (Exception("Should not throw this type of exception", ex))
}
```
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>`.
```fsharp
open IcedTasks
open FSharp.Control
Expand Down
Binary file added msbuild.binlog
Binary file not shown.
334 changes: 126 additions & 208 deletions src/IcedTasks/CancellableTaskBuilderBase.fs

Large diffs are not rendered by default.

376 changes: 137 additions & 239 deletions src/IcedTasks/TaskBuilderBase.fs

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions tests/IcedTasks.Tests/CancellablePoolingValueTaskTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ module CancellablePoolingValueTaskTests =

let! actual =
cancellablePoolingValueTask {
for (i: int) in asyncSeq do
for i in asyncSeq do
do! Task.Yield()
index <- i + i

Expand Down Expand Up @@ -967,10 +967,10 @@ module CancellablePoolingValueTaskTests =

let doOtherStuff (l: ResizeArray<_>) x =
cancellablePoolingValueTask {
l.Add(x)
lock l (fun () -> l.Add(x))
do! Task.yieldMany 1000
let dt = DateTimeOffset.UtcNow
l.Add(x)
lock l (fun () -> l.Add(x))
return dt
}

Expand Down
4 changes: 2 additions & 2 deletions tests/IcedTasks.Tests/CancellableTaskTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -926,10 +926,10 @@ module CancellableTaskTests =

let doOtherStuff (l: ResizeArray<_>) x =
cancellableTask {
l.Add(x)
lock l (fun () -> l.Add(x))
do! Task.yieldMany 1000
let dt = DateTimeOffset.UtcNow
l.Add(x)
lock l (fun () -> l.Add(x))
return dt
}

Expand Down
4 changes: 2 additions & 2 deletions tests/IcedTasks.Tests/CancellableValueTaskTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -963,10 +963,10 @@ module CancellableValueTaskTests =

let doOtherStuff (l: ResizeArray<_>) x =
cancellableValueTask {
l.Add(x)
lock l (fun () -> l.Add(x))
do! Task.yieldMany 1000
let dt = DateTimeOffset.UtcNow
l.Add(x)
lock l (fun () -> l.Add(x))
return dt
}

Expand Down
4 changes: 2 additions & 2 deletions tests/IcedTasks.Tests/PoolingValueTaskTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -690,10 +690,10 @@ module PoolingValueTaskTests =

let doOtherStuff (l: ResizeArray<_>) x =
poolingValueTask {
l.Add(x)
lock l (fun () -> l.Add(x))
do! Task.yieldMany 1000
let dt = DateTimeOffset.UtcNow
l.Add(x)
lock l (fun () -> l.Add(x))
return dt
}

Expand Down
4 changes: 2 additions & 2 deletions tests/IcedTasks.Tests/TaskTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -693,10 +693,10 @@ module TaskTests =

let doOtherStuff (l: ResizeArray<_>) x =
task {
l.Add(x)
lock l (fun () -> l.Add(x))
do! Task.yieldMany 1000
let dt = DateTimeOffset.UtcNow
l.Add(x)
lock l (fun () -> l.Add(x))
return dt
}

Expand Down
4 changes: 2 additions & 2 deletions tests/IcedTasks.Tests/ValueTaskTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -690,10 +690,10 @@ module ValueTaskTests =

let doOtherStuff (l: ResizeArray<_>) x =
valueTask {
l.Add(x)
lock l (fun () -> l.Add(x))
do! Task.yieldMany 1000
let dt = DateTimeOffset.UtcNow
l.Add(x)
lock l (fun () -> l.Add(x))
return dt
}

Expand Down

0 comments on commit c78fd63

Please sign in to comment.