65 struct timeval start_time;
70 info->name =
"named_lock_test";
71 info->category =
"/main/lock/";
72 info->summary =
"Named Lock test";
74 "Tests that named locks operate as expected";
87 ast_test_validate_cleanup(
test, lock1 !=
NULL, res, fail);
90 ast_test_validate_cleanup(
test, lock2 !=
NULL, res, fail);
123 ast_test_validate_cleanup(
test, duration > 1500 && duration < 3500, res, fail);
132 pthread_join(thread1,
NULL);
133 pthread_join(thread2,
NULL);
#define AST_MODULE_INFO_STANDARD(keystr, desc)
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
#define AST_TEST_REGISTER(cb)
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
static int load_module(void)
#define ast_test_status_update(a, b, c...)
static void * lock_thread(void *data)
#define AST_TEST_UNREGISTER(cb)
static int unload_module(void)
#define ast_pthread_create(a, b, c, d)
AST_TEST_DEFINE(named_lock_test)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
#define ast_named_lock_get(lock_type, keyspace, key)
Geta named lock handle.
#define ast_named_lock_put(lock)
Put a named lock handle away.