Here’s a simple app which has a loop in the main thread, and a loop in a Thread. Both loops spend most of their time sleeping, e.g.
while true
[... do some simple string operations ...]
sleep(10)
wend
When run using a Cooperative thread, CPU usage is low (a few %) as expected.
When run using a Preemptive thread, CPU usage is pegged at 100%.
preemptiveCPU.zip (6.3 KB)
Reported as https://tracker.xojo.com/xojoinc/xojo/-/issues/77526
13 posts - 7 participants