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

5a570e1fd1b2a27d2ff6fa1ad41d316d2167dfe2 breaks non-local returns from Mutex.withLock #3988

Closed
chaoren opened this issue Dec 16, 2023 · 1 comment
Labels

Comments

@chaoren
Copy link

chaoren commented Dec 16, 2023

Describe the bug

What happened? What should have happened instead?

Prior to 5a570e1, you can return from a Mutex.withLock block and the mutex will unlock as expected.

After 5a570e1, the mutex will remain locked after the return.

Provide a Reproducer

  • If possible, please provide a small self-contained project (or even just a single file) where the issue reproduces.

    val mutex = Mutex()
    
    suspend fun nonLocalReturn() { mutex.withLock { return } }
    
    fun main() {
      runBlocking {
        nonLocalReturn()
        println(mutex.isLocked) // should be false
      }
    }
@chaoren chaoren added the bug label Dec 16, 2023
@chaoren
Copy link
Author

chaoren commented Dec 16, 2023

Oh, sorry. Dupe of #3985.

@chaoren chaoren closed this as completed Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant