Recent

Author Topic: Is working with RTTI thread-safe?  (Read 1459 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 18363
  • Here stood a man who saw the Elbe and jumped it.
Re: Is working with RTTI thread-safe?
« Reply #15 on: September 07, 2025, 06:40:52 pm »
@LV
That is a bit pointless if we are discussing the thread safety of extended RTTI and you don't use it.
We knew that...
As you can see from marcov 's trace the error is obviously in the rtticontext INSIDE a thread and the subsequent rtti calls.
Caching is no option here, the rtti needs to be fixed.
« Last Edit: September 07, 2025, 06:49:36 pm by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

Thaddy

  • Hero Member
  • *****
  • Posts: 18363
  • Here stood a man who saw the Elbe and jumped it.
Re: Is working with RTTI thread-safe?
« Reply #16 on: September 08, 2025, 06:36:21 am »
Reported as
#41398
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

Thaddy

  • Hero Member
  • *****
  • Posts: 18363
  • Here stood a man who saw the Elbe and jumped it.
Re: Is working with RTTI thread-safe?
« Reply #17 on: September 09, 2025, 08:43:02 am »
There is a fix for it in todays trunk. Will report back the results. The original code should now compile.

[edit]
The original code now compiles, and runs correctly first time, but there is still a problem because the CS is not released correctly, so running a second time gives:
Code: [Select]
Error: Invalid argument index in format "A RTTI object with handle 0x%x is already registered"
Thread done.1
That is easy to overlook if you do not run the code a second time. Running it first time now succeeds.
The OS resource, the CS, is not (yet) correctly released. This can't be caught with heaptrc.

As I referred to before the issue is that on both Linux and Windows the synchronization primitives are kernel objects, so if they are not released, running a second time will fail.
« Last Edit: September 09, 2025, 09:27:41 am by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

yus

  • Jr. Member
  • **
  • Posts: 62
Re: Is working with RTTI thread-safe?
« Reply #18 on: September 09, 2025, 09:14:56 am »
Thank you very much! 👍

Thaddy

  • Hero Member
  • *****
  • Posts: 18363
  • Here stood a man who saw the Elbe and jumped it.
Re: Is working with RTTI thread-safe?
« Reply #19 on: September 09, 2025, 09:28:42 am »
Thank you very much! 👍
Well, it is not fixed yet... But there is progress. I edited my post a little to explain what is still wrong.
Oh, btw, the reason that count shows one and not 0 is because I edited your source to include {$M+} and made the property published instead of public. I also released the threads of course.
« Last Edit: September 09, 2025, 09:36:39 am by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

 

TinyPortal © 2005-2018