Thread
#multiplatform
    n

    Nikiizvorski

    1 year ago
    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

    bsimmons

    1 year ago
    Do you mean the coroutines mutex lock?
    n

    Nikiizvorski

    1 year ago
    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

    bsimmons

    1 year ago
    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

    Nikiizvorski

    1 year ago
    Yep you are right. Might be the best option will look more into that.
    b

    bsimmons

    1 year ago
    Yeah, if you want multiplatform you should convert the Java thread stuff to kotlin coroutines.
    c

    CLOVIS

    1 year ago
    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).