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

chanrecv blocked while it shouldn't be #58

Open
ammarbinfaisal opened this issue Aug 21, 2023 · 2 comments
Open

chanrecv blocked while it shouldn't be #58

ammarbinfaisal opened this issue Aug 21, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@ammarbinfaisal
Copy link
Owner

the code below gets stuck at 999 each time

fun sendvals(c: chan<int>, count: int) {
    let i = 0
    while i < count {
        c <- i
        i = i + 1
    }
}

fun main() {
    let i = 0
    while i < 100 {
        let count = 1000
        let a = make(chan<int>, count)
        sahl sendvals(a, count)
        let j = 0
        while j < count {
            print(<-a, "\n")
            j = i + 1
        }
        i = i + 1
    }
}
@ammarbinfaisal ammarbinfaisal added the bug Something isn't working label Aug 21, 2023
@ammarbinfaisal ammarbinfaisal changed the title coroutines dont exit at times chanrecv blocked while it shouldn't be Aug 22, 2023
@mayankpatel-mit
Copy link

try j = j + 1 instead of j = i + 1

@ammarbinfaisal
Copy link
Owner Author

I see what the error in the example was but I still remains blocked. Something's wrong with how channels are implemented in the vm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants