diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-05 22:07:54 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-05 22:07:54 +0000 |
commit | af44a1b17a6864b6772c7384dca8552b8b7dc0ad (patch) | |
tree | 947c3faf9360ca486ceaa1819e458e755a14f01e /include/asterisk | |
parent | 5c1b77dc882e5c390f879bba6773d6a36d1c5bcd (diff) |
After seeing crashes related to channel variables, I went looking around at the
ways that channel variables are handled. In general, they were not handled in
a thread-safe way. The channel _must_ be locked when reading or writing from/to
the channel variable list.
What I have done to improve this situation is to make pbx_builtin_setvar_helper()
and friends lock the channel when doing their thing. Asterisk API calls almost
all lock the channel for you as necessary, but this family of functions did not.
(closes issue #10923, reported by atis)
(closes issue #11159, reported by 850t)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@88805 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include/asterisk')
-rw-r--r-- | include/asterisk/pbx.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h index c558289c7..699aa5082 100644 --- a/include/asterisk/pbx.h +++ b/include/asterisk/pbx.h @@ -764,13 +764,37 @@ struct ast_ignorepat *ast_walk_context_ignorepats(struct ast_context *con, struct ast_ignorepat *ip); struct ast_sw *ast_walk_context_switches(struct ast_context *con, struct ast_sw *sw); +/*! + * \note Will lock the channel. + */ int pbx_builtin_serialize_variables(struct ast_channel *chan, char *buf, size_t size); + +/*! + * \note Will lock the channel. + */ const char *pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name); + +/*! + * \note Will lock the channel. + */ void pbx_builtin_pushvar_helper(struct ast_channel *chan, const char *name, const char *value); + +/*! + * \note Will lock the channel. + */ void pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value); + +/*! + * \note Will lock the channel. + */ void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, char *workspace, int workspacelen, struct varshead *headp); void pbx_builtin_clear_globals(void); + +/*! + * \note Will lock the channel. + */ int pbx_builtin_setvar(struct ast_channel *chan, void *data); + void pbx_substitute_variables_helper(struct ast_channel *c,const char *cp1,char *cp2,int count); void pbx_substitute_variables_varshead(struct varshead *headp, const char *cp1, char *cp2, int count); |