Closed mouridis closed 5 years ago
Hi @mouridis,
Each JsonDocument
is independent and there is no global variable in ArduinoJson.
ArduinoJson is thread-safe as long as you use a different JsonDocument
in each thread.
Best Regards, Benoit
Thank you!
Sorry, this is not an issue but a question really.
I'm using ArduinoJson in an ESP32 based project (using ESP32 Arduino core). I have custom functions which accept JSON documents as a String objects and they use ArduinoJson to manipulate them (return a value given a key, add a key/value pair etc).
For example:
The thing is, these functions are called from multiple threads in my code and I was wondering if this is safe. I would guess that since the functions create new objects each time they are called and they do not manipulate let's say a global json object, it's safe. Right?
Also, how about in general? Is ArduinoJson thread-safe in general?