Thread Safety Issue due to "ep"
Brought to you by:
davegamble
cJSON contains a static global "ep" pointer that could be a problem for threads safety. I am not sure whether the "thread safety" has been verified for cJSON, but "ep" is one potential problem.
To fix this, one way is to pass "ep" as parameter to the functions where it is being modified.
cJSON.c patch
cJSON.h patch
In order to maintain source compatibility, new thread safe flavors for each of the functions that touch ep would need to be introduced with the extra parameter. Or some macro magic to make it client-selectable.
I think making cJSON thread safe in 2016 should be high priority.
Last edit: Marcos Kirsch 2016-01-13