Move ISeekableStream to own file

This commit is contained in:
Davide Depau committed 2024-10-08 18:37:42 +02:00
1 parent cd1558e4e4
commit 3c2c620d16
2 files changed
+13 -10

No files matched your search

@@ -9,7 +9,6 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.ClosedReceiveChannelException
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.withContext
@@ -29,15 +28,6 @@ private fun BlockDeviceOutputStream.traceIo(msg: String) {
if (TRACE_IO) println("OSTREAM: ${Thread.currentThread().name} time ${System.nanoTime()} pos $mCurrentOffset $msg")
}
interface ISeekableStream {
fun seek(offset: Long): Long {
return runBlocking { seekAsync(offset) }
}
suspend fun seekAsync(offset: Long): Long {
return seek(offset)
}
}
class BlockDeviceOutputStream(
private val blockDev: BlockDeviceDriver,
@@ -0,0 +1,13 @@
package eu.depau.etchdroid.massstorage
import kotlinx.coroutines.runBlocking
interface ISeekableStream {
fun seek(offset: Long): Long {
return runBlocking { seekAsync(offset) }
}
suspend fun seekAsync(offset: Long): Long {
return seek(offset)
}
}