34 #define NAMED_LOCKS_BUCKETS 101 75 int keylen = strlen(keyspace) + strlen(key) + 2;
78 sprintf(concat_key,
"%s-%s", keyspace, key);
82 __PRETTY_FUNCTION__, filename, lineno, func);
95 lock =
__ao2_alloc(
sizeof(*lock) + keylen,
NULL, lock_type, concat_key, filename, lineno, func);
102 goto failure_cleanup;
106 goto failure_cleanup;
109 strcpy(proxy->
key, concat_key);
112 ao2_t_ref(proxy, -1,
"Release allocation reference");
#define ao2_t_ref(o, delta, tag)
Reference/unreference an object and return the old refcount.
static void named_lock_proxy_cb(void *weakproxy, void *data)
#define ao2_weakproxy_set_object(weakproxy, obj, flags)
Asterisk main include file. File version handling, generic pbx functions.
#define AO2_STRING_FIELD_HASH_FN(stype, field)
Creates a hash function for a structure string field.
The arg parameter is a search key, but is not an object.
void * __ao2_alloc(size_t data_size, ao2_destructor_fn destructor_fn, unsigned int options, const char *tag, const char *file, int line, const char *func) attribute_warn_unused_result
Assume that the ao2_container is already locked.
#define ao2_link_flags(container, obj, flags)
int ao2_weakproxy_subscribe(void *weakproxy, ao2_weakproxy_notification_cb cb, void *data, int flags)
Request notification when weakproxy points to NULL.
struct ao2_container * named_locks
static void named_locks_shutdown(void)
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
ast_named_lock_type
Which type of lock to request.
void * __ao2_weakproxy_find(struct ao2_container *c, const void *arg, enum search_flags flags, const char *tag, const char *file, int line, const char *func)
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
struct ast_named_lock * __ast_named_lock_get(const char *filename, int lineno, const char *func, enum ast_named_lock_type lock_type, const char *keyspace, const char *key)
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
#define ao2_unlink(container, obj)
Prototypes for public functions only of internal interest,.
#define AO2_STRING_FIELD_CMP_FN(stype, field)
Creates a compare function for a structure string field.
int ast_named_locks_init(void)
unsigned int ao2_options_get(void *obj)
Retrieve the ao2 options used to create the object.
#define ao2_t_weakproxy_alloc(data_size, destructor_fn, tag)
#define NAMED_LOCKS_BUCKETS