Hello all, is there a way to do one of the two fol...
# getting-started
b
Hello all, is there a way to do one of the two following things? 1. in a normal blocking function, determine if the function was called from a coroutine context 2. Warn a user in a meaningful way that they should not call a specific blocking function from a coroutine context (ideally by failing to compile as if i tried to call a suspend fun from a blocking fun, but a really good warning is good enough for me) I know that if I add a false
@Throws(IOException::class)
to my method, it gets highlighted as an inappropriate blocking call in IDEA, and I can just add docs to the method and hope people read them when they get the unrelated warning. However, I’m hoping for something a little more direct. Anyone have any ideas or pointers?
🤔 2
e
ask in #coroutines but I believe there's nothing at the moment. https://youtrack.jetbrains.com/issue/KT-17260 is a possible future idea but has no implementation.
b
ah, yes, nosuspend would be perfect for what i need. thanks for the pointer to watch. i’ll ask again in coroutines.