Asterisk - The Open Source Telephony Project
21.4.1
|
SCOPED_LOCK unit tests. More...
#include "asterisk.h"
#include "asterisk/test.h"
#include "asterisk/utils.h"
#include "asterisk/module.h"
#include "asterisk/astobj2.h"
Go to the source code of this file.
Data Structures | |
struct | test_struct |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
AST_TEST_DEFINE (lock_test) | |
AST_TEST_DEFINE (cleanup_order) | |
static int | load_module (void) |
static void | lock_it (ast_mutex_t *lock) |
static struct test_struct * | test_iterator_next (struct ao2_iterator *iter) |
wrapper for ao2_iterator_next More... | |
static void | test_lock (struct test_struct *test) |
lock callback function More... | |
static struct test_struct * | test_ref (struct test_struct *test) |
ref callback function More... | |
static void | test_unlock (struct test_struct *test) |
unlock callback function More... | |
static void | test_unref (struct test_struct *test) |
unref callback function More... | |
static int | unload_module (void) |
static void | unlock_it (ast_mutex_t *lock) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "SCOPED_LOCK test module" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_test * | current_test |
static int | indicator |
static ast_mutex_t | the_lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
SCOPED_LOCK unit tests.
Definition in file test_scoped_lock.c.
|
static |
wrapper for ao2_iterator_next
Grabs the next item in the container and replaces the ref acquired from ao2_iterator_next() with a call to test_ref().
Definition at line 179 of file test_scoped_lock.c.
References ao2_ref, and test_ref().
|
static |
lock callback function
Locks the object passed in. Only sets the locked flag if the object is reffed. This allows us to check that locking is always occurring after reffing.
Definition at line 115 of file test_scoped_lock.c.
|
static |
ref callback function
Refs the object passed in. Only sets the reffed flag if the object is not locked. This allows us to ensure that reffing always occurs before locking.
Definition at line 147 of file test_scoped_lock.c.
References ao2_ref.
Referenced by test_iterator_next().
|
static |
unlock callback function
Unlocks the object passed in. Only clears the locked flag if the object is still reffed. This allows us to ensure that unlocking is always occurring before unreffing.
Definition at line 131 of file test_scoped_lock.c.
|
static |
unref callback function
Unrefs the object passed in. Only sets the unreffed flag if the object is not locked. This allows us to ensure that unreffing always occurs after unlocking.
Definition at line 164 of file test_scoped_lock.c.
References ao2_ref.