Asterisk - The Open Source Telephony Project  18.5.0
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.

Referenced by ast_named_locks_init().

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.

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

Referenced by asterisk_daemon().

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 }
#define NULL
Definition: resample.c:96
struct ao2_container * named_locks
Definition: named_locks.c:33
static void named_locks_shutdown(void)
Definition: named_locks.c:47
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
Definition: clicompat.c:19
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Definition: astobj2.h:1310
#define NAMED_LOCKS_BUCKETS
Definition: named_locks.c:34

◆ named_lock_proxy_cb()

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

Definition at line 65 of file named_locks.c.

References ao2_unlink.

Referenced by __ast_named_lock_get().

66 {
67  ao2_unlink(named_locks, weakproxy);
68 }
struct ao2_container * named_locks
Definition: named_locks.c:33
#define ao2_unlink(container, obj)
Definition: astobj2.h:1598

◆ named_locks_shutdown()

static void named_locks_shutdown ( void  )
static

Definition at line 47 of file named_locks.c.

References ao2_cleanup.

Referenced by ast_named_locks_init().

48 {
50 }
struct ao2_container * named_locks
Definition: named_locks.c:33
#define ao2_cleanup(obj)
Definition: astobj2.h:1958

Variable Documentation

◆ named_locks

struct ao2_container* named_locks

Definition at line 33 of file named_locks.c.