typelevel / typelevel/cats-effect
Implement an optimized `Queue.synchronous` for `Async[F]`
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 2.2k
- Forks
- 576
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 18
Description
The new, optimized Queue implementation(s)(from #2885) don't support queues of size 0. The fact that the existing Concurrent versions do is actually kind of interesting and weird. In a lot of ways, Queue.synchronous is a very different data structure from Queue.bounded. It should be possible to implement it using a pair of queues, UnsafeUnbounded[(A, Right[Nothing, Unit] => Unit)] and UnsafeUnbounded[Right[Nothing, A] => Unit], but the race conditions on the double-check are very tricky. This is still probably worth doing though since synchronous is a commonly used primitive in a lot of cases.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at Queue.synchronous and read the referenced UnsafeUnbounded queue implementations. Work out the double-check race conditions for the paired queues, then verify that zero-sized synchronous queues behave correctly without losing or duplicating values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100