Pre-Emptive Threading!

Like others, I’m eager to test this out. Do we have any info about when this will show up? Will it be in 2024 R2 betas?

1 Like

Well, if Xojo must review all (or most) of its frameworks, I don’t imagine it’ll come that soon.

4 Likes

Hopefully “next up…”

will be … TA DAAAA … dynamic libraries?

just sayin’

Oh look!
I see Jesus in the clouds and hell freezing over!

2 Likes

I expect we’ll see it rolled out in stages. Like the first round might get us Dictionary and FolderItem, but maybe not URLConnection. Then each release would support a few more framework classes. At least, that’s how I’d do it.

5 Likes

You don’t need FolderItem or UrlConnection “Thread safe”

Since like in other Programming languages then those are not example of classes you make Thread safe. Reason is obviously that you use single instance of UrlConnection in one thread only and never same url connection instance in 2 threads.

Dictionary is example of where Thread safety might be desirable, or make 2nd version of it ThreadSafeDictionary (like some other languages do to not hurt performance of the main one)

1 Like

That’s a fair point, I was just picking classes for the sake of discussion.

1 Like

Actually URLConnection is thread-safe. :slight_smile:

As @Thom_McGrath correctly stated, it will happen incrementally. We will give you a list of the classes and such that you can reliably call with a preemptive thread. The performance is quite good depending on what you are doing and what platform you are doing it on.

Why are we doing this now? Well, it’s not exactly now. William started looking into this over a year ago. Way in the past we knew there was so much that was not thread-safe that it wasn’t worth bothering with. We actually had a large company ask us how much they’d have to pay us to make the entire console framework thread-safe and after some investigation, it just didn’t seem practical. However, things change as time goes on. We continuously upgrade our code and William thought that perhaps it was now more practical. It’s looking quite good. Once we start r2 beta testing, you’ll see for yourself.

21 Likes

I look forward to that. But I must respectfully say that I am disappointed that you’ve already indicated that, as with Workers, this can’t really be tested properly in the debugger. While I’ve made effective use of Workers, that did create a booby trap or two. :slight_smile:

5 Likes

Threads connect to the debugger via the thread scheduler which makes them cooperative. Perhaps some day we could update the debugger to handle preemptive threads but everything has to be prioritized of course.

4 Likes