Top level values can be only accessed from the main thread. (#1922)

This commit is contained in:
Nikolay Igotti
2018-08-24 12:37:59 +03:00
committed by GitHub
parent 1d015e1fc8
commit 066429831e
14 changed files with 104 additions and 18 deletions
@@ -20,6 +20,7 @@ import kotlinx.cinterop.*
import platform.posix.memcpy
// This global variable only set to != null value in the decoding worker.
@ThreadLocal
private var decoder: Decoder? = null
data class VideoInfo(val size: Dimensions, val fps: Double)
@@ -76,6 +76,7 @@ class SDLAudio(val player: VideoPlayer) : DisposableContainer() {
}
// Only set in the audio thread
@ThreadLocal
private var decoder: DecoderWorker? = null
private fun audioCallback(userdata: COpaquePointer?, buffer: CPointer<Uint8Var>?, length: Int) {