json: Audit ast_json_* usage for thread safety.
authorJoshua Colp <jcolp@digium.com>
Mon, 14 Dec 2015 18:04:15 +0000 (14:04 -0400)
committerJoshua Colp <jcolp@digium.com>
Wed, 16 Dec 2015 21:21:14 +0000 (15:21 -0600)
commitd17d9a92886429b185b7bc2e02e429fc43d39652
tree689dceca969ae2a0e0b1bcc7074784f5eb98cb34
parent093f14d7f3e6a84fc2e6baf2ff950a915e9f91d8
json: Audit ast_json_* usage for thread safety.

The JSON library Asterisk uses, jansson, is not thread
safe for us in a few ways. To help with this wrappers for JSON
object reference count increasing and decreasing were added
which use a global lock to ensure they don't clobber over
each other. This does not extend to reference count manipulation
within the jansson library itself. This means you can't safely
use the object borrowing specifier (O) in ast_json_pack and
you can't share JSON instances between objects.

This change removes uses of the O specifier and replaces them
with the o specifier and an explicit ast_json_ref. Some cases
of instance sharing have also been removed.

ASTERISK-25601 #close

Change-Id: I06550d8b0cc1bfeb56cab580a4e608ae4f1ec7d1
main/aoc.c
main/loader.c
main/rtp_engine.c
main/stasis.c
main/stasis_channels.c
res/res_fax.c
res/res_stasis.c
res/res_stasis_playback.c
res/res_stasis_recording.c
res/stasis/app.c