Hey guys i need to use Lock and implementation(“or...
# multiplatform
n
Hey guys i need to use Lock and implementation(“org.jetbrains.kotlin:kotlin-stdlib-common”) but IOS compains in my project any tips? Is it supported on IOS
b
Do you mean the coroutines mutex lock?
n
I currently use private val lock: ReentrantLock = ReentrantLock() and i need something in Kotlin that should work the same way. I am using Mutex but it needs a suspend fun
b
If you are going to be using kotlin multiplatform, then the coroutines mutex lock is likely the best choice.
It sounds like you're still using Java-based threads right now?
n
Yep you are right. Might be the best option will look more into that.
b
Yeah, if you want multiplatform you should convert the Java thread stuff to kotlin coroutines.
c
System threads are not available on all platforms (in particular, JS), so there's no way to implement most blocking things in a Multiplatform context. Coroutines solve that problem (and are all around much easier to work with).