Skip to content

Commit 3951fbf

Browse files
committed
Use Interlocked.Increment for our dummy tasks in the tests
1 parent 01c083d commit 3951fbf

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/FSharpy.TaskSeq.Test/TestUtils.fs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace FSharpy.Tests
1+
namespace FSharpy.Tests
22

33
open System
44
open System.Threading
@@ -65,12 +65,13 @@ type DummyTaskFactory(µsecMin: int64<µs>, µsecMax: int64<µs>) =
6565
//let! _ = Task.Delay(rnd ())
6666
let! _ = Task.Delay 0 // this creates a resume state, which seems more efficient than SpinWait.SpinOnce, see DelayHelper.
6767
DelayHelper.delayMicroseconds (rnd ()) false
68-
x <- x + 1
68+
Interlocked.Increment &x |> ignore
69+
//x <- x + 1
6970
return x // this dereferences the variable
7071
}
7172

7273
let runTaskDirect i = backgroundTask {
73-
x <- x + 1
74+
Interlocked.Increment &x |> ignore
7475
return x
7576
}
7677

0 commit comments

Comments
 (0)