In preparation for the inclusion of preemptive threads in an upcoming release, I have developed ThreadPool, a framework for processing a job using multiple preemptive threads.
The hope is that this, or something like it, is eventually included in the Xojo framework, so comments for changes/improvements will help facilitate that.
The project is in a GitHub repo (links below) in the develop branch that will only run in whatever version of Xojo ultimately offers this feature. But since, right now, almost nobody has access to such a version, I’ve included a branch called pre-2024r3-preview that will let you run it in the current release as cooperative threads. This should give you an idea of what it’s about, how to use it, and how it’s being tested.
NOTE: Since preemptive threads are still in development, anything and everything is subject to change. Approach this accordingly.
The main repo is:
The preview branch that will run in Xojo 2024r2.1is:
(That preview branch will be removed after preemptive threads have been released.)
The included README file and example should be enough to get you started, but feel free to post questions or comments here.
One more thing: there is an iOS unit test harness where the SQLite test fails. I am aware, it’s likely something I did wrong, and I’ll fix it eventually.
One more thought. Perhaps the p-thread is being assigned to an efficiency core vs a performance core. I don’t know if that’s a thing or there is a way around that if it is, so I’ve asked @William_Yu about this.
And again, everything is subject to change at this point.
My understanding is that Priority in cooperative threads controls how often the thread yields time to other threads/main thread. That would have no impact on a preemptive thread, and my tests bear that out.
I was always under the impression it is not allowed to discuss/brag about things that are in beta/alpha outside the beta channel.
Seems some can get away with this (although those mostly close threads when they think it is appropiate to do so).
It’s always been allowed if you ask for, and receive, permission from Xojo, which Kem both asked for and waited quite some time for. Failure to follow those steps and adhere to their decision has always been frowned upon. Given that and Geoff’s previous public statements, it’s not surprising that this is allowed to be discussed publicly.
Kem and the other MVPs are excited about this new feature and we’ve spent hundreds of hours (especially Kem) testing, building unit tests, and creating examples for it already in an attempt to help find bugs before it gets to beta. I commend his efforts and his willingness to share his time by discussing the feature and answering questions.
TLDR; If you want to talk publicly about a beta, you ask Xojo. If they say yes, you’re fine. If they say no or you don’t ask in the first place, then you might be in trouble.
Anyhow, I do look forward to preemptive threads but reading here often from Kem that it might not or might be in the release is not really valuable information that I think is best left out. In short, just wait when things are solid enough to tease.
I don’t see how. He had to go through the same process to divulge privileged information to the public that anyone else would, but I don’t want to further derail the thread with this.
It’s helpful to show the possibilities and caveats of something that will be available soon(ish). To help others understand the process, and see what Kem has done with it already. There’s nothing wrong with wanting to share your work. I don’t understand why this is an issue, but I’m happy to drop it here.