I have a requirement where I have to wait for completion of callback of an sdk for a maximum of 500 millis. If the callback takes more than 500 millis then the suspend function should just return and the submission should continue normally but the caller should not get suspended for more than 500 millis.
The problem is that the sdk does not use coroutines and there is no cooperative cancellation because of this, so the normal withTimeout function will not work as it only cancels at suspension points. Has anyone solved this kind of problem with coroutines ?