diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-01 21:10:07 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-01 21:10:07 +0000 |
commit | b1f91b97d2085cc845d0f57bd9907de50c995105 (patch) | |
tree | 9c836ac808552d20be6bd2baa3a3c29f642eda53 /funcs/func_lock.c | |
parent | c5d084051f21e943fcbcc347fc80b166885f298d (diff) |
Merge changes from team/group/appdocsxml
This commit introduces the first phase of an effort to manage documentation of the
interfaces in Asterisk in an XML format. Currently, a new format is available for
applications and dialplan functions. A good number of conversions to the new format
are also included.
For more information, see the following message to asterisk-dev:
http://lists.digium.com/pipermail/asterisk-dev/2008-October/034968.html
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@153365 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs/func_lock.c')
-rw-r--r-- | funcs/func_lock.c | 67 |
1 files changed, 47 insertions, 20 deletions
diff --git a/funcs/func_lock.c b/funcs/func_lock.c index 133ea3e22..d6df6d0ef 100644 --- a/funcs/func_lock.c +++ b/funcs/func_lock.c @@ -37,6 +37,53 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/module.h" #include "asterisk/linkedlists.h" +/*** DOCUMENTATION + <function name="LOCK" language="en_US"> + <synopsis> + Attempt to obtain a named mutex. + </synopsis> + <syntax> + <parameter name="lockname" required="true" /> + </syntax> + <description> + <para>Attempts to grab a named lock exclusively, and prevents other channels from + obtaining the same lock. LOCK will wait for the lock to become available. + Returns <literal>1</literal> if the lock was obtained or <literal>0</literal> on error.</para> + <note><para>To avoid the possibility of a deadlock, LOCK will only attempt to + obtain the lock for 3 seconds if the channel already has another lock.</para></note> + </description> + </function> + <function name="TRYLOCK" language="en_US"> + <synopsis> + Attempt to obtain a named mutex. + </synopsis> + <syntax> + <parameter name="lockname" required="true" /> + </syntax> + <description> + <para>Attempts to grab a named lock exclusively, and prevents other channels + from obtaining the same lock. Returns <literal>1</literal> if the lock was + available or <literal>0</literal> otherwise.</para> + </description> + </function> + <function name="UNLOCK" language="en_US"> + <synopsis> + Unlocks a named mutex. + </synopsis> + <syntax> + <parameter name="lockname" required="true" /> + </syntax> + <description> + <para>Unlocks a previously locked mutex. Returns <literal>1</literal> if the channel + had a lock or <literal>0</literal> otherwise.</para> + <note><para>It is generally unnecessary to unlock in a hangup routine, as any locks + held are automatically freed when the channel is destroyed.</para></note> + </description> + </function> + ***/ + + + AST_LIST_HEAD_STATIC(locklist, lock_frame); static void lock_free(void *data); @@ -276,36 +323,16 @@ static int trylock_read(struct ast_channel *chan, const char *cmd, char *data, c static struct ast_custom_function lock_function = { .name = "LOCK", - .synopsis = "Attempt to obtain a named mutex", - .desc = -"Attempts to grab a named lock exclusively, and prevents other channels from\n" -"obtaining the same lock. LOCK will wait for the lock to become available.\n" -"Returns 1 if the lock was obtained or 0 on error.\n\n" -"Note: to avoid the possibility of a deadlock, LOCK will only attempt to\n" -"obtain the lock for 3 seconds if the channel already has another lock.\n", - .syntax = "LOCK(<lockname>)", .read = lock_read, }; static struct ast_custom_function trylock_function = { .name = "TRYLOCK", - .synopsis = "Attempt to obtain a named mutex", - .desc = -"Attempts to grab a named lock exclusively, and prevents other channels\n" -"from obtaining the same lock. Returns 1 if the lock was available or 0\n" -"otherwise.\n", - .syntax = "TRYLOCK(<lockname>)", .read = trylock_read, }; static struct ast_custom_function unlock_function = { .name = "UNLOCK", - .synopsis = "Unlocks a named mutex", - .desc = -"Unlocks a previously locked mutex. Note that it is generally unnecessary to\n" -"unlock in a hangup routine, as any locks held are automatically freed when the\n" -"channel is destroyed. Returns 1 if the channel had a lock or 0 otherwise.\n", - .syntax = "UNLOCK(<lockname>)", .read = unlock_read, }; |