Commit cd99819e authored by Nikolay Igotti's avatar Nikolay Igotti

Cleaner locks.

parent 64946688
......@@ -60,6 +60,8 @@ internal class MetalRedrawer(
private suspend fun draw() {
withContext(Dispatchers.IO) {
val handle = startRendering()
synchronized(disposeLock) {
if (!isDisposed)
if (layer.prepareDrawContext()) {
// 2,3 GHz 8-Core Intel Core i9
//
......@@ -72,12 +74,9 @@ internal class MetalRedrawer(
//
// Executors.newSingleThreadExecutor().asCoroutineDispatcher(): 50 FPS, 150% CPU
// Dispatchers.IO: 50 FPS, 200% CPU
synchronized(disposeLock) {
if (!isDisposed) {
layer.draw()
}
}
}
endRendering(handle)
}
// When window is not visible - it doesn't make sense to redraw fast to avoid battery drain.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment