Skip to content

Align select() behavior to match GoLang #22

@yruslan

Description

@yruslan

Describe the feature

In Go a select() statement that uses the same synchronous channel in a single thread will fail on the deadlock. In Scala channels implemented in this project, the code won't block, and also the send will transfer the value, but the receiver won't be triggered until another such call.

Here is an example:

val channel = Channel.make[Int]

select(
  channel.recver(n => {
    println(s"Received $n")
  }),
  channel.sender(10) {
    println("Sent 10")
  }
)

Scala code will print "Sent 10", GoLang equivalent code will fail on deadlock.

Since Scala does not have deadlock checkers, it should just deadlock in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions