review changes

This commit is contained in:
shenlong-tanwen
2025-09-29 05:46:09 +05:30
parent 0e8492ceba
commit f632e4f666
2 changed files with 2 additions and 9 deletions

View File

@@ -4,7 +4,6 @@ import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
fun <T> dispatch(
dispatcher: CoroutineDispatcher = Dispatchers.IO,
@@ -12,9 +11,6 @@ fun <T> dispatch(
block: () -> T
) {
CoroutineScope(dispatcher).launch {
val result = runCatching { block() }
withContext(Dispatchers.Main) {
callback(result)
}
callback(runCatching { block() })
}
}

View File

@@ -4,9 +4,6 @@ func dispatch<T>(
block: @escaping () throws -> T
) {
DispatchQueue.global(qos: qos).async {
let result = Result { try block() }
DispatchQueue.main.async {
completion(result)
}
completion(Result { try block() })
}
}