From b1f91b97d2085cc845d0f57bd9907de50c995105 Mon Sep 17 00:00:00 2001 From: russell Date: Sat, 1 Nov 2008 21:10:07 +0000 Subject: 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 --- funcs/func_lock.c | 67 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 20 deletions(-) (limited to 'funcs/func_lock.c') 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 + + + Attempt to obtain a named mutex. + + + + + + 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 1 if the lock was obtained or 0 on error. + 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. + + + + + Attempt to obtain a named mutex. + + + + + + Attempts to grab a named lock exclusively, and prevents other channels + from obtaining the same lock. Returns 1 if the lock was + available or 0 otherwise. + + + + + Unlocks a named mutex. + + + + + + Unlocks a previously locked mutex. Returns 1 if the channel + had a lock or 0 otherwise. + It is generally unnecessary to unlock in a hangup routine, as any locks + held are automatically freed when the channel is destroyed. + + + ***/ + + + 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()", .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()", .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()", .read = unlock_read, }; -- cgit v1.2.1