62 info->name =
"lock_test";
63 info->category =
"/main/lock/";
64 info->summary =
"SCOPED_LOCK test";
66 "Tests that scoped locks are scoped as they are expected to be";
82 ast_log(
LOG_ERROR,
"The lock was not released when the variable went out of scope");
86 for (i = 0; i < 10; ++i) {
95 ast_log(
LOG_ERROR,
"The lock was not released when the variable went out of scope");
207 info->name =
"cleanup_order_test";
208 info->category =
"/main/lock/";
209 info->summary =
"cleanup order test";
211 "Tests that variables with cleanup attributes are cleaned up\n"
212 "in the reverse order they are declared.";
232 if (!object->reffed || !object->locked) {
238 if (object->reffed || object->locked) {
254 if (!object->reffed || !object->locked) {
261 if (object->reffed || object->locked) {
Asterisk main include file. File version handling, generic pbx functions.
#define ao2_iterator_next(iter)
#define ao2_link(container, obj)
Add an object to a container.
@ AO2_ALLOC_OPT_LOCK_MUTEX
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define ao2_alloc(data_size, destructor_fn)
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Allocate and initialize a hash container with the desired number of buckets.
#define ast_mutex_unlock(a)
#define SCOPED_LOCK(varname, lock, lockfunc, unlockfunc)
Scoped Locks.
#define ast_mutex_lock(a)
#define AST_MUTEX_DEFINE_STATIC(mutex)
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
struct ao2_container * container
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Structure for mutex and tracking information.
#define AST_TEST_REGISTER(cb)
#define ast_test_status_update(a, b, c...)
#define AST_TEST_UNREGISTER(cb)
static struct test_struct * test_ref(struct test_struct *test)
ref callback function
static void test_unref(struct test_struct *test)
unref callback function
static ast_mutex_t the_lock
static void test_unlock(struct test_struct *test)
unlock callback function
static struct ast_test * current_test
static void lock_it(ast_mutex_t *lock)
static void test_lock(struct test_struct *test)
lock callback function
AST_TEST_DEFINE(lock_test)
static int load_module(void)
static int unload_module(void)
static void unlock_it(ast_mutex_t *lock)
static struct test_struct * test_iterator_next(struct ao2_iterator *iter)
wrapper for ao2_iterator_next
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.