# Request of true multi-core threads

**URL:** <https://forum.xojo.com/t/request-of-true-multi-core-threads/74516>\
**Category:** General\
**Created:** [February 16, 2023, 4:53pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516 "2023-02-16T16:53:50Z")\
**Posts on this page:** 20\
**Page:** 4

<div class="post-metadata">

**Author:** ![Greg\_O](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o/32/22785_2.png) [@Greg\_O](https://forum.xojo.com/u/Greg_O)\
**Post date:** [February 22, 2023, 12:51pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516/61 "2023-02-22T12:51:10Z")

</div>

> [@Ulrich\_Bogun](#):
>
> Apple’s APIs are implementing more and more Block callbacks. Xojo is preventing their usage currently, or making a difficult task a full expert thing.

That’s not true. You can get Block callbacks with ObjCBlock.

[https://documentation.xojo.com/api/macos/objcblock.html](https://documentation.xojo.com/api/macos/objcblock.html)

As for the asynchronous ones, it is possible, but you need to make sure you stay away from the Xojo framework (because it’s not thread-safe). The easiest way to do this is to only do intrinsic type assignments in the callback method, using a timer or a thread that you started before the call to wait for the callback to finish. It’s not fun but it does work.

---

<div class="post-metadata">

**Author:** ![Ulrich\_Bogun](https://forum.xojo.com/user_avatar/forum.xojo.com/ulrich_bogun/32/1864_2.png) [@Ulrich\_Bogun](https://forum.xojo.com/u/Ulrich_Bogun)\
**Post date:** [February 22, 2023, 12:53pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516/62 "2023-02-22T12:53:52Z")

</div>

That’s exactly what I meant. It’s not fun currently, and having a basic threadsafe framework would alleviate this tediousness quite a bit.

---

<div class="post-metadata">

**Author:** ![Björn\_Eiríksson](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/da6949/32.png) [@Björn\_Eiríksson](https://forum.xojo.com/u/Bj%C3%B6rn_Eir%C3%ADksson)\
**Post date:** [February 22, 2023, 1:26pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516/63 "2023-02-22T13:26:05Z")

</div>

You do not even need all the framework thread safe.

You just need few basic things.

If we take .NET C# then not all objects are thread safe. Arrays are not thread safe and other such. (It does though offer special types of Concurrent Arrays also) but over all not all objects are thread safe.

That does not mean you cannot use it in a thread. You can use object that is not thread safe in a thread as long as it is the only thread accessing the given object.

So for example if we take file io, it would not necessarily need to be thread safe, as long as just one thread accesses the same file. (Other thread still could access some other file at same time).

This goes for most programming languages that most things are not “thread safe” its just up to the user to not let two threads access same non thread safe object from two threads at same time. If user really needs to access non thread safe objects from two threads at same time then the user needs to protect them with mutexes, again same as in other programming languages.

Which is why I have stated that its almost a sin that the memory manager is not fixed up. Since its basically the New, Reference and De-reference you need to fix and then you have most basic things (and also a lot of advanced things working in a native thread).

Xojo even could keep their non native threads if they wanted also, and just create new object “NativeThread” or some other suitable name. Only thing stopping this from being possible currently is the memory management. Which is relatively simple to fix.

(I gave them just about the c++ code for it in this issue here [https://tracker.xojo.com/xojoinc/xojo/-/issues/68072](https://tracker.xojo.com/xojoinc/xojo/-/issues/68072) )

And lastly the argument that someone posted far above…“But that will not allow you to access UI from thread”…that is same as in all other programming languages. And same with the current non native Xojo threads, so I do not even understand why this argument is on the table.

---

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [February 22, 2023, 3:13pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516/64 "2023-02-22T15:13:34Z")

</div>

In the feature request, I made the argument that simple documentation would be sufficient. “If you misuse this, your app will crash hard. Good luck.” Classes can be make thread-safe as required over time.

---

<div class="post-metadata">

**Author:** ![Aaron\_Hunt](https://forum.xojo.com/user_avatar/forum.xojo.com/aaron_hunt/32/23752_2.png) [@Aaron\_Hunt](https://forum.xojo.com/u/Aaron_Hunt)\
**Post date:** [February 28, 2023, 1:16pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516/65 "2023-02-28T13:16:59Z")

</div>

> [@Geoff\_Perlman](#):
>
> We could quite easily make preemptive threads available but then your apps would start crashing every time you accessed something that you didn’t realize was not thread-safe.

Then please make them available with the warning that it’s up to us to handle thread safety.

---

<div class="post-metadata">

**Author:** ![Eric\_Williams](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/ecccb3/32.png) [@Eric\_Williams](https://forum.xojo.com/u/Eric_Williams)\
**Post date:** [February 28, 2023, 3:03pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516/66 "2023-02-28T15:03:11Z")

</div>

This would be disastrous for the reputation of the language and the company. The support burden would be enormous: they’d have to carefully investigate and document every corner of the framework that isn’t thread safe, and then prepare for the onslaught of feature requests to make this or that compatible with threads.

Xojo would get a reputation for “that language that makes apps that are always crashing” and “good language, half-baked thread implementation”.

Do it right or don’t do it, I say.

---

<div class="post-metadata">

**Author:** ![KarenA](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/c89c15/32.png) [@KarenA](https://forum.xojo.com/u/KarenA)\
**Post date:** [February 28, 2023, 3:36pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516/67 "2023-02-28T15:36:17Z")

</div>

> [@Eric\_Williams](#):
>
> Do it right or don’t do it, I say.

When has the first iteration of any new Xojo feature been “right” or complete?

-Karen

---

<div class="post-metadata">

**Author:** ![Aaron\_Hunt](https://forum.xojo.com/user_avatar/forum.xojo.com/aaron_hunt/32/23752_2.png) [@Aaron\_Hunt](https://forum.xojo.com/u/Aaron_Hunt)\
**Post date:** [February 28, 2023, 3:42pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516/68 "2023-02-28T15:42:28Z")

</div>

> [@Eric\_Williams](#):
>
> “good language, half-baked thread implementation”.

I’d say that might be close to the present reputation, since Xojo “threads” aren’t real threads. They call it “cooperative threading”, but all that means is that the threads aren’t real threads.

---

<div class="post-metadata">

**Author:** ![Eric\_Williams](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/ecccb3/32.png) [@Eric\_Williams](https://forum.xojo.com/u/Eric_Williams)\
**Post date:** [February 28, 2023, 3:47pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516/69 "2023-02-28T15:47:36Z")

</div>

Just because the threading model isn’t what you would like it to be doesn’t invalidate it. Xojo’s cooperative threads behave as designed, and the design, while limited by its cooperative nature, is sound.

---

<div class="post-metadata">

**Author:** ![Eric\_Williams](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/ecccb3/32.png) [@Eric\_Williams](https://forum.xojo.com/u/Eric_Williams)\
**Post date:** [February 28, 2023, 3:50pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516/70 "2023-02-28T15:50:06Z")

</div>

Xojo features have definitely had issues, I’m not denying that. But they haven’t felt the need to include caveats that “using this feature with the vast majority of the language is guaranteed to cause crashes.”

---

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [February 28, 2023, 4:20pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516/71 "2023-02-28T16:20:34Z")

</div>

We don’t know that that’s true. We do know that it would be possible to crash if used incorrectly, but that may require “quick” (relatively speaking) changes to avoid. I’d leave that to the engineers. The rest can be covered by a warning as mentioned in my request.

But if we wait until it’s done “right”, it won’t be done at all and Xojo will be relegated to a niche language forever. I hope it can be introduced as a beta or experimental feature, perhaps just at the Pro level, then updated over time.

---

<div class="post-metadata">

**Author:** ![Ivan\_Tellez](https://forum.xojo.com/letter_avatar_proxy/v4/letter/i/a9a28c/32.png) [@Ivan\_Tellez](https://forum.xojo.com/u/Ivan_Tellez)\
**Post date:** [February 28, 2023, 4:21pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516/72 "2023-02-28T16:21:28Z")

</div>

> [@Eric\_Williams](#):
>
> This would be disastrous for the reputation of the language and the company. The support burden would be enormous: they’d have to carefully investigate and document every corner of the framework that isn’t thread safe, and then prepare for the onslaught of feature requests to make this or that compatible with threads.

lol that is ridiculous. Not everyone is going to use threads… those who will, are not going to use them in every app and certainly not using it for every single method to have a situation where the apps is crashing just because the framework has the feature.

---

<div class="post-metadata">

**Author:** ![Greg\_O](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o/32/22785_2.png) [@Greg\_O](https://forum.xojo.com/u/Greg_O)\
**Post date:** [February 28, 2023, 4:31pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516/73 "2023-02-28T16:31:41Z")

</div>

> [@Kem\_Tekinay](#):
>
> But if we wait until it’s done “right”, it won’t be done at all and Xojo will be relegated to a niche language forever.

That’s not fair. You’re failing to mention the fact that the majority of applications don’t “need” or won’t benefit from preemptive threads. Image processing, probably. Crypto processing, also probably. Compiling applications, _maybe_… Xojo itself works just fine using a spawned console process for that.

I’ve been programming for close to 30 years and I can only thing of two instances when I’ve even thought that something like preemptive threads would be helpful and eventually settled on separate console apps _because they get their own resources._

---

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [February 28, 2023, 4:33pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516/74 "2023-02-28T16:33:59Z")

</div>

Also in data processing where we use them all the time to handle multi-GB files.

Just not in Xojo.

---

<div class="post-metadata">

**Author:** ![Eugene\_Dakin](https://forum.xojo.com/user_avatar/forum.xojo.com/eugene_dakin/32/178_2.png) [@Eugene\_Dakin](https://forum.xojo.com/u/Eugene_Dakin)\
**Post date:** [February 28, 2023, 4:37pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516/75 "2023-02-28T16:37:20Z")

</div>

Also in electronics such as raspberry Pi. Getting real world data on one preemptive thread, showing the data on another preemptive thread, processing the data on another preemptive thread.

---

<div class="post-metadata">

**Author:** ![Jose\_Fernandez\_del\_Valle](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/9de0a6/32.png) [@Jose\_Fernandez\_del\_Valle](https://forum.xojo.com/u/Jose_Fernandez_del_Valle)\
**Post date:** [February 28, 2023, 4:47pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516/76 "2023-02-28T16:47:54Z")

</div>

> [@Kem\_Tekinay](#):
>
> Also in data processing where we use them all the time to handle multi-GB files.

Perhaps this thread is the most relevant thing in the corporate world, especially when they involve transaction handling.

Do not forget to mention science, where it is common to handle millions of data.

---

<div class="post-metadata">

**Author:** ![Jose\_Fernandez\_del\_Valle](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/9de0a6/32.png) [@Jose\_Fernandez\_del\_Valle](https://forum.xojo.com/u/Jose_Fernandez_del_Valle)\
**Post date:** [February 28, 2023, 4:53pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516/77 "2023-02-28T16:53:51Z")

</div>

> [@Greg\_O](#):
>
> You’re failing to mention the fact that the majority of applications don’t “need” or won’t benefit from preemptive threads. Image processing, probably. Crypto processing, also probably. Compiling applications, _maybe_…

I agree with you.

But, I have observed that some systems have gained a position in the market for being faster.

In the 80s, it was common to see competition to be the fastest. You can see that when the first versions of Windows sucked.

---

<div class="post-metadata">

**Author:** ![anon20074439](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/ac8455/32.png) [@anon20074439](https://forum.xojo.com/u/anon20074439)\
**Post date:** [February 28, 2023, 4:57pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516/78 "2023-02-28T16:57:58Z")

</div>

> [@Kem\_Tekinay](#):
>
> Xojo will be relegated to a niche language forever

If your measure for Xojo remaining niche is a lack of “advanced” features then so much more needs to be done before this is even contemplated, xojo will remain a niche language if core bugs aren’t addressed, I can’t believe that time is being put in to things like WinUI before these, its embarrassing:

[Obtaining a handle via a pictures graphic object stops future access](https://tracker.xojo.com/xojoinc/xojo/-/issues/54028) - 4 years old  
[Structure alignment issues in Windows](https://tracker.xojo.com/xojoinc/xojo/-/issues/51124) - 5 years old  
[Invalid access to memory location when trying to use a pointer to a structure in 2018r1 64bit](https://tracker.xojo.com/xojoinc/xojo/-/issues/52211) - 4 years old  
[Passing structures as parameters are corrupting data](https://tracker.xojo.com/xojoinc/xojo/-/issues/70682) - 3 months old

---

<div class="post-metadata">

**Author:** ![Kem\_Tekinay](https://forum.xojo.com/user_avatar/forum.xojo.com/kem_tekinay/32/154_2.png) [@Kem\_Tekinay](https://forum.xojo.com/u/Kem_Tekinay)\
**Post date:** [February 28, 2023, 5:05pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516/79 "2023-02-28T17:05:53Z")

</div>

You make a valid point, but please don’t hijack the thread.

---

<div class="post-metadata">

**Author:** ![anon20074439](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/ac8455/32.png) [@anon20074439](https://forum.xojo.com/u/anon20074439)\
**Post date:** [February 28, 2023, 5:08pm UTC](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516/80 "2023-02-28T17:08:09Z")

</div>

I’m not hijacking the thread, I’m saying that other things are more important than implementing this, its perfectly on topic.

[Previous page](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516.md?page=3)

[Next page](https://forum.xojo.com/t/request-of-true-multi-core-threads/74516.md?page=5)
