# coroutines


03/17/2024, 2:02 PM
Is there a way to suspend until a mutex is unlocked, but without locking it? I.e. there's some kind of operation that "locks" the mutex, and only it can run. But there's another, "friendly" kind of operation that can run concurrently with other "friendly" operations, but not when the mutex is locked. That also means a locking operation will have to suspend until all "friendly" operations finish.


03/17/2024, 2:14 PM
What you're looking for I think is a readers writers lock. Kotlinx coroutines does not currently have support for this out of the box. I suggest you chime in here:


03/17/2024, 2:33 PM
Ayup, found the issue, thanks.
Am currently working on implementing my own, I think...
My own implementation of the Read-Write Mutex proved a bit too hard and time-expensive. Actors are only available on the JVM, as they're considered obsolete because of complex actors, that aren't implemented yet. What alternative do I have, besides using a single mutex for both read and write?