add worker thread tracking

add stGen which gets bumped for every worker thread spawned by
loadBook

every thread captures stGen when it spawns and before actually loading
the book in the main thread, and in the worker thread it checks if
myGen == stGen

this throws away stale requests, meaning if you try and load another
book while one is still loading, it will ignore the one still loading
and start loading the latest request
This commit is contained in:
Marko Andjelic 2026-07-01 21:18:46 +01:00
commit 81c2caaf67
Signed by: marko
GPG key ID: 9C5E99C8C682FB59
3 changed files with 39 additions and 26 deletions

View file

@ -18,5 +18,6 @@ initialState title path =
stIndex = ChapterIndex 0,
stZoom = 1.0,
stTitle = title,
stBookPath = path
stBookPath = path,
stGen = 0
}