mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 13:08:46 +00:00
Add CoroutineJob.
This commit is contained in:
committed by
Greyson Parrelli
parent
9f5773bb7a
commit
9ff2577efe
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2024 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.thoughtcrime.securesms.jobmanager
|
||||
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
||||
/**
|
||||
* Perform a job utilizing operations that require coroutines. By default,
|
||||
* doRun is executed on the Default dispatcher.
|
||||
*/
|
||||
abstract class CoroutineJob(parameters: Parameters) : Job(parameters) {
|
||||
|
||||
override fun run(): Result {
|
||||
return runBlocking {
|
||||
doRun()
|
||||
}
|
||||
}
|
||||
|
||||
abstract suspend fun doRun(): Result
|
||||
}
|
||||
Reference in New Issue
Block a user