I'm currently working on a file indexer for my pet project tonehub[1] (an audio API like navidrome or audiobookshelf). I thought this is gonna be an easy task, but after running into a lot of problems it turned out that this is indeed an interesting problem to solve. Just to name a few problems I ran into: - Performance: How to scan files as fast as possible? - Tag-Storage: How to store audio tags as generic as possi…
If you have a worker thread that has a hot loop that checks a pthread structure as its limit. You can then send a virtual interrupt to it, or preempt it from running further by setting the loop to its limit.
You can see my C, Java and Rust code of this in this repository: https://github.com/samsquire/preemptible-thread
It can be used to create extremely responsive software without slowing down the system with cancellation checks.
https://github.com/samsquire/ideas4#120-cancellation-trees https://github.com/samsquire/ideas4#99-register-loop