Page 1 of 1

[done] Is PB JSON implementation thread-safe?

Posted: Fri Aug 18, 2017 8:49 am
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...

Re: Is PB JSON implementation thread-safe?

Posted: Fri Aug 18, 2017 11:31 am
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.

Re: Is PB JSON implementation thread-safe?

Posted: Fri Aug 18, 2017 11:57 am
by Kukulkan
Great! Thanks Fred :D

Re: Is PB JSON implementation thread-safe?

Posted: Fri Aug 18, 2017 12:35 pm
by Little John
Also thanks from me! That's good to know.
Maybe this information could be added to the PureBasic JSON documentation?