Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to eliminate race condition in QueueSpec #1008

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions core/jvm/src/test/scala/fs2/async/QueueSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ class QueueSpec extends Fs2Spec {
f <- async.start(q.peek1)
g <- async.start(q.peek1)
_ <- q.enqueue1(42)
b <- q.offer1(43)
x <- f
y <- g
b <- q.offer1(43)
z <- q.peek1
} yield List(b, x, y, z)
)).flatten shouldBe Vector(true, 42, 42, 43)
Expand All @@ -174,13 +174,11 @@ class QueueSpec extends Fs2Spec {
q <- async.synchronousQueue[IO, Int]
none1 <- q.timedPeek1(100.millis, scheduler)
_ <- async.start(q.enqueue1(42))
f <- async.start(q.timedPeek1(1000.millis, scheduler))
x <- q.dequeue1
y <- f
none2 <- q.timedPeek1(100.millis, scheduler)
} yield List(none1, x, y, none2)
} yield List(none1, x, none2)
)
}).flatten shouldBe Vector(None, 42, Some(42), None)
}).flatten shouldBe Vector(None, 42, None)
}
"peek1 synchronous None-terminated queue" in {
runLog(Stream.eval(
Expand Down