What I need to use in worker instead of `sleep`? `...
# kotlin-native
a
What I need to use in worker instead of
sleep
?
Copy code
Worker.start().execute(TransferMode.SAFE, {}) {
  ...
  ??? sleep(100u)
}
On MacOS
sleep
leads error
flock failed to lock maps file: errno = 35
delay
doesn’t allowed out of coroutine.
Copy code
runBlocking {
                    delay(100)
                }
It works but looks ugly.
a
There was a StackOverflow question on this, I would suggest using posix
sleep(...)
here.
a
I have error with poxis sleep on OSX
a
My bad. Seems like the problem is caused by the fact, that while your worker executes
posix.sleep
, your main function just goes further with no waiting, resulting in this error. Try adding the
consume{}
block, it helped for a snippet I’ve played just now.