Asterisk - The Open Source Telephony Project GIT-master-7e7a603
Data Structures | Macros | Functions | Variables
named_locks.c File Reference

Named Locks. More...

#include "asterisk.h"
#include "asterisk/_private.h"
#include "asterisk/astobj2.h"
#include "asterisk/named_locks.h"
#include "asterisk/utils.h"
Include dependency graph for named_locks.c:

Go to the source code of this file.

Data Structures

struct  ast_named_lock
 
struct  named_lock_proxy
 

Macros

#define NAMED_LOCKS_BUCKETS   101
 

Functions

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)
 
int ast_named_locks_init (void)
 
static void named_lock_proxy_cb (void *weakproxy, void *data)
 
static void named_locks_shutdown (void)
 

Variables

struct ao2_containernamed_locks
 

Detailed Description

Named Locks.

Author
George Joseph georg.nosp@m.e.jo.nosp@m.seph@.nosp@m.fair.nosp@m.view5.nosp@m..com

Definition in file named_locks.c.

Macro Definition Documentation

◆ NAMED_LOCKS_BUCKETS

#define NAMED_LOCKS_BUCKETS   101

Definition at line 34 of file named_locks.c.

Function Documentation

◆ ast_named_locks_init()

int ast_named_locks_init ( void  )

Provided by named_locks.c

Definition at line 52 of file named_locks.c.

53{
55 NAMED_LOCKS_BUCKETS, named_lock_proxy_hash_fn, NULL, named_lock_proxy_cmp_fn);
56 if (!named_locks) {
57 return -1;
58 }
59
61
62 return 0;
63}
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
Definition: clicompat.c:19
@ AO2_ALLOC_OPT_LOCK_MUTEX
Definition: astobj2.h:363
#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.
Definition: astobj2.h:1303
#define NAMED_LOCKS_BUCKETS
Definition: named_locks.c:34
static void named_locks_shutdown(void)
Definition: named_locks.c:47
struct ao2_container * named_locks
Definition: named_locks.c:33
#define NULL
Definition: resample.c:96

References AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ast_register_cleanup(), named_locks, NAMED_LOCKS_BUCKETS, named_locks_shutdown(), and NULL.

Referenced by asterisk_daemon().

◆ named_lock_proxy_cb()

static void named_lock_proxy_cb ( void *  weakproxy,
void *  data 
)
static

Definition at line 65 of file named_locks.c.

66{
67 ao2_unlink(named_locks, weakproxy);
68}
#define ao2_unlink(container, obj)
Remove an object from a container.
Definition: astobj2.h:1578

References ao2_unlink, and named_locks.

Referenced by __ast_named_lock_get().

◆ named_locks_shutdown()

static void named_locks_shutdown ( void  )
static

Definition at line 47 of file named_locks.c.

48{
50}
#define ao2_cleanup(obj)
Definition: astobj2.h:1934

References ao2_cleanup, and named_locks.

Referenced by ast_named_locks_init().

Variable Documentation

◆ named_locks

struct ao2_container* named_locks