I noticed this new Worker class and thought wow.. maybe this is just what I need!
I currently use an array of Async Shell Instances…
I poll those instances and update according the the shell state.
I understood that each shell gets its own core.
So on an 8 core machine i try not to use more than 4 cores. (Running shell instances)
The Threading Model has changed as well and at some point I wondered if each Shell should be run in a thread.
Maybe each is about the same in the end?
No. Workers are Shells internally, so you’re just putting Shells inside of Shells. Using Shells in Async mode is the correct way to proceed.
Using Preemptive Threads just so you can put the Shell in Synchronous mode would also be a very bad idea™ if you already have properly designed Async Shells.
3 Likes
If your asynchronous Shells are meeting your needs, ignore Workers – they are not new in any sense and are essentially deprecated now that Xojo has preemptive threading.
However, depending on what you are using your Shells for, you might look into the new preemptive threads. They could save you a very considerable amount of coding effort by allowing you to keep all your code in a single project and, when running, all of your data in a single process/address space. They do come with challenges; you’ll have to be careful about what and when you read/write data to object properties to avoid collisions, and they might not necessarily be more performant than your asynchronous Shell solution.
1 Like