This is a very exciting development and will open opportunities for a new “breed” of Xojo apps which natively support multi-core processors (basically all of them today, right??) with fewer compromises than workers.
Kudos to @Geoff_Perlman and the whole Xojo team for making this happen. I’m sure it was a huge amount of work behind the scenes to get Xojo ready for pre-emptive threading.
However… if other heavy tasks can be passed off to preemptive threads, it leaves more “free time” for cooperative threads (the only kind we have today) to do more work.
Obviously, it depends on your app design, and as Christian said, “the evil is in the detail”, but… this feels like a step in the right direction to me.
I believe preemptive threads will be a real improvement over workers since the threads will be part of the “main application” and therefore should have much better access to all of the application’s resources (which is almost certainly where the critical sections and mutexes will come into play) vs. the “narrow tunnel” we get to pass data back and forth with Workers.
Processing of large data sets (without having to pass them back and forth through a "thin channel the way workers do) and filesystem operations seem like good candidates for preemptive threading for my personal use cases. I’m sure there are many more opportunities, especially for plug-in makers.
I just hope that running things on legacy mode don’t get affected too by the changes or Xojo will get a layer of discredit breaking everything, old and new, instead of an upgrade on its image to the market.
If they document it correctly so the ins-and-outs are known and how to use it is known (including what can be done to get things wrong) then there will be not so much issues as if it’s just “dropped” into the framework.
Xojo can do such thing, but docs and use-cases etc would be helpful for these kind of threads.
The web framework could benefit a lot from this. All the xojo code to parse requests and assemble the html & JavaScript could use this.
But you also have to learn how to use it.
Like you can’t use for each over a dictionary while another thread adds/removes a key.
Quite a few things that are fine today will need different coding to work preemptively.
There will need to be a low-overhead way of protecting a sequence of code from being interrupted. Back in the 1970s when I was doing this sort of stuff on bare metal (well, a PDP-11 actually), it sufficed to disable interrupts for a few instructions, then re-enable them. Cheap.