Should preemptive threads use 100% CPU?

Trying out preemptive threads in a console app, and it no matter how much sleep time I give the threads or the main event loop, the process uses exactly 100% CPU in activity monitor. Is this normal? I can’t imagine it would be, but I figured I’d ask.

Switching to cooperative brings the CPU down to normal levels.

1 Like

You are not the only one:
#77526 - Preemptive Thread burning 100% CPU

Edit: here a forum topic

Thanks. For what it’s worth, I’m not using SleepCurrent myself, but that probably doesn’t matter. Mine is just DoEvents to run the main loop, and Self.Sleep inside the thread class.

If you can test the latest beta, please do.

Technically it helped. But practically it did not. I was already on the beta, but was a build or two behind. So now I’m around 98% CPU instead of 100%. Progress!

SCR-20241018-navl

1 Like

Check the latest, if you haven’t already. Should help. If if doesn’t please report back on the issue.

Yes when I started the topic I was behind. But my last comment is using the latest. It’s not fixed, at least not for console apps.

2 Likes