05nelsonm / kmp-tor

Kotlin Multiplatform Library for embedding Tor into your applications
Apache License 2.0
33 stars 5 forks source link

Remove usage of `suspendCancellableCoroutine` #388

Closed 05nelsonm closed 5 months ago

05nelsonm commented 5 months ago

When utilizing the executeAsync APIs and the job completes exceptionally, if the continuation.resumeWithException is uncaught by caller, it will be propagated to the job's handler. In TorRuntime implementation's case, that will be the error observer. We want to detach that OnFailure lambda from the execution of the EnqueuedJob and throw the exception outside the lambda.

So, need to implement something comparable to the awaitSync API and replace usage of suspendCancellableCoroutine.