[done] Is PB JSON implementation thread-safe?

Everything else that doesn't fall into one of the other PB categories.
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

[done] Is PB JSON implementation thread-safe?

Post by Kukulkan »

I just wanted to use the built-in JSON functions, but functions like JSONErrorLine(), JSONErrorMessage() and JSONErrorPosition() do not accept any parameter.

How do I get the right text for the thread reliably? Or is the function itself thread-safe? So an error is not overwriting the results of a previous error in another thread? The documentation does not mention thread-safety for the JSON functions at all...
Last edited by Kukulkan on Fri Aug 18, 2017 1:13 pm, edited 1 time in total.
Fred
Administrator
Administrator
Posts: 16619
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Is PB JSON implementation thread-safe?

Post by Fred »

Yes, it's threadsafe, a thread local storage is used for these function. In PB if nothing is mentioned, it's threadsafe (if you check the thread safe switch), or it's a bug.
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: Is PB JSON implementation thread-safe?

Post by Kukulkan »

Great! Thanks Fred :D
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Is PB JSON implementation thread-safe?

Post by Little John »

Also thanks from me! That's good to know.
Maybe this information could be added to the PureBasic JSON documentation?
Post Reply