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) {
#define AST_MODULE_INFO_STANDARD(keystr, desc)
static ast_mutex_t the_lock
Asterisk main include file. File version handling, generic pbx functions.
static void test_lock(struct test_struct *test)
lock callback function
#define AST_TEST_REGISTER(cb)
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define ast_mutex_lock(a)
static int unload_module(void)
static struct test_struct * test_ref(struct test_struct *test)
ref callback function
static void lock_it(ast_mutex_t *lock)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_test_status_update(a, b, c...)
#define ao2_ref(o, delta)
#define SCOPED_LOCK(varname, lock, lockfunc, unlockfunc)
Scoped Locks.
struct ao2_container * container
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
static void test_unlock(struct test_struct *test)
unlock callback function
#define AST_TEST_UNREGISTER(cb)
static void test_unref(struct test_struct *test)
unref callback function
static int load_module(void)
#define ao2_iterator_next(iter)
#define ao2_alloc(data_size, destructor_fn)
static struct test_struct * test_iterator_next(struct ao2_iterator *iter)
wrapper for ao2_iterator_next
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
AST_TEST_DEFINE(lock_test)
static void unlock_it(ast_mutex_t *lock)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define AST_MUTEX_DEFINE_STATIC(mutex)
Structure for mutex and tracking information.
static struct ast_test * current_test
static struct ast_test * test
#define ast_mutex_unlock(a)
#define ao2_link(container, obj)