diff options
author | Joshua Colp <jcolp@digium.com> | 2013-12-18 19:28:05 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2013-12-18 19:28:05 +0000 |
commit | e2630fcd516b8f794bf342d9fd267b0c905e79ce (patch) | |
tree | f6cd5cf70eb9af24b239d78391aed7472c09dd7f /include | |
parent | e23b8d19a49d4ee4faf3dc167ddb7ba7afe36a46 (diff) |
channels: Return allocated channels locked.
This change makes ast_channel_alloc return allocated channels
locked. By doing so no other thread can acquire, lock, and manipulate
the channel before it is completely set up.
(closes issue AST-1256)
Review: https://reviewboard.asterisk.org/r/3067/
........
Merged revisions 404204 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404210 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/channel.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index 03d9aef68..51530a82b 100644 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -791,7 +791,8 @@ typedef int(*ast_timing_func_t)(const void *data); * active channels in the system. The hash key is based on the channel name. Because * of this, if you want to change the name, you _must_ use ast_change_name(), not change * the name field directly. When ast_channel_alloc() returns a channel pointer, you now - * hold a reference to that channel. In most cases this reference is given to ast_pbx_run(). + * hold both a reference to that channel and a lock on the channel. Once the channel has + * been set up the lock can be released. In most cases the reference is given to ast_pbx_run(). * * \par Channel Locking * There is a lock associated with every ast_channel. It is allocated internally via astobj2. @@ -1122,6 +1123,7 @@ struct ast_datastore *ast_channel_datastore_find(struct ast_channel *chan, const * \note Absolutely _NO_ channel locks should be held before calling this function. * \note By default, new channels are set to the "s" extension * and "default" context. + * \note Since 12.0.0 this function returns with the newly created channel locked. */ struct ast_channel * attribute_malloc __attribute__((format(printf, 13, 14))) __ast_channel_alloc(int needqueue, int state, const char *cid_num, @@ -1140,6 +1142,7 @@ struct ast_channel * attribute_malloc __attribute__((format(printf, 13, 14))) * \note Absolutely _NO_ channel locks should be held before calling this function. * \note By default, new channels are set to the "s" extension * and "default" context. + * \note Since 12.0.0 this function returns with the newly created channel locked. */ #define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, linkedid, amaflag, ...) \ __ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, linkedid, amaflag, \ |