Skip to content

Commit 5f95a56

Browse files
committed
Fix deadlock on Channel tests
1 parent e3afefd commit 5f95a56

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

shared/src/main/scala/async/channels.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ object Channel:
276276
* there are *only* all readers or all senders. It must be externally synchronized.
277277
*/
278278
private[async] class CellBuf():
279-
case class Send(cs: CanSend, sender: Sender^)
279+
final case class Send(cs: CanSend, sender: Sender^)
280280
type Cell = Reader | Send
281281
// reader == 0 || sender == 0 always
282282
private var reader = 0
@@ -293,7 +293,8 @@ object Channel:
293293
pending.head.asInstanceOf[Reader]
294294
def nextSender =
295295
require(sender > 0)
296-
pending.head.asInstanceOf[(CanSend, Sender)]
296+
val Send(cs, s) = pending.head.asInstanceOf[Send]
297+
(cs, s)
297298
def dequeue() =
298299
pending.dequeue()
299300
if reader > 0 then reader -= 1 else sender -= 1

0 commit comments

Comments
 (0)