AutoCloseable with suspend close method?

Is there a coroutines-aware AutoCloseable defined somewhere? Basically, I want to be able to suspend the coroutine on close.

I can easily define my own interface, use, etc. to do that, but it sounds like something general enough to be in the coroutines library.

Thanks!

5 Likes