Asterisk - The Open Source Telephony Project  GIT-master-1f78ee9
Data Structures | Macros | Typedefs | Functions
lock.h File Reference

Asterisk locking-related definitions: More...

#include <pthread.h>
#include <time.h>
#include <sys/param.h>
#include <execinfo.h>
#include "asterisk/backtrace.h"
#include "asterisk/logger.h"
#include "asterisk/compiler.h"
#include "asterisk/inline_api.h"

Go to the source code of this file.

Data Structures

struct  ast_lock_track
 Lock tracking information. More...
 
struct  ast_lock_track_flags
 
struct  ast_mutex_info
 Structure for mutex and tracking information. More...
 
struct  ast_rwlock_info
 Structure for rwlock and tracking information. More...
 

Macros

#define __AST_MUTEX_DEFINE(scope, mutex, init_val, track)   scope ast_mutex_t mutex = init_val
 
#define __AST_RWLOCK_DEFINE(scope, rwlock, init_val, track)   scope ast_rwlock_t rwlock = init_val
 
#define __AST_RWLOCK_INIT_VALUE   PTHREAD_RWLOCK_INITIALIZER
 
#define AO2_DEADLOCK_AVOIDANCE(obj)
 
#define ast_cond_broadcast(cond)   __ast_cond_broadcast(__FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, cond)
 
#define ast_cond_destroy(cond)   __ast_cond_destroy(__FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, cond)
 
#define ast_cond_init(cond, attr)   __ast_cond_init(__FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, cond, attr)
 
#define ast_cond_signal(cond)   __ast_cond_signal(__FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, cond)
 
#define ast_cond_timedwait(cond, mutex, time)   __ast_cond_timedwait(__FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, #mutex, cond, mutex, time)
 
#define ast_cond_wait(cond, mutex)   __ast_cond_wait(__FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, #mutex, cond, mutex)
 
#define AST_LOCK_TRACK_INIT_VALUE   { { NULL }, { 0 }, 0, { NULL }, { 0 }, {{{ 0 }}}, PTHREAD_MUTEX_INIT_VALUE }
 
#define AST_MAX_REENTRANCY   10
 
#define AST_MUTEX_DEFINE_STATIC(mutex)   __AST_MUTEX_DEFINE(static, mutex, AST_MUTEX_INIT_VALUE, 1)
 
#define AST_MUTEX_DEFINE_STATIC_NOTRACKING(mutex)   __AST_MUTEX_DEFINE(static, mutex, AST_MUTEX_INIT_VALUE_NOTRACKING, 0)
 
#define ast_mutex_destroy(a)   __ast_pthread_mutex_destroy(__FILE__, __LINE__, __PRETTY_FUNCTION__, #a, a)
 
#define ast_mutex_init(pmutex)   __ast_pthread_mutex_init(1, __FILE__, __LINE__, __PRETTY_FUNCTION__, #pmutex, pmutex)
 
#define ast_mutex_init_notracking(pmutex)   __ast_pthread_mutex_init(0, __FILE__, __LINE__, __PRETTY_FUNCTION__, #pmutex, pmutex)
 
#define AST_MUTEX_INIT_VALUE   { PTHREAD_MUTEX_INIT_VALUE, NULL, {1, 0} }
 
#define AST_MUTEX_INIT_VALUE_NOTRACKING   { PTHREAD_MUTEX_INIT_VALUE, NULL, {0, 0} }
 
#define AST_MUTEX_INITIALIZER   __use_AST_MUTEX_DEFINE_STATIC_rather_than_AST_MUTEX_INITIALIZER__
 
#define AST_MUTEX_KIND   PTHREAD_MUTEX_RECURSIVE_NP
 
#define ast_mutex_lock(a)   __ast_pthread_mutex_lock(__FILE__, __LINE__, __PRETTY_FUNCTION__, #a, a)
 
#define ast_mutex_trylock(a)   __ast_pthread_mutex_trylock(__FILE__, __LINE__, __PRETTY_FUNCTION__, #a, a)
 
#define ast_mutex_unlock(a)   __ast_pthread_mutex_unlock(__FILE__, __LINE__, __PRETTY_FUNCTION__, #a, a)
 
#define AST_PTHREADT_NULL   (pthread_t) -1
 
#define AST_PTHREADT_STOP   (pthread_t) -2
 
#define AST_RWLOCK_DEFINE_STATIC(rwlock)   __AST_RWLOCK_DEFINE(static, rwlock, AST_RWLOCK_INIT_VALUE, 1)
 
#define AST_RWLOCK_DEFINE_STATIC_NOTRACKING(rwlock)   __AST_RWLOCK_DEFINE(static, rwlock, AST_RWLOCK_INIT_VALUE_NOTRACKING, 0)
 
#define ast_rwlock_destroy(rwlock)   __ast_rwlock_destroy(__FILE__, __LINE__, __PRETTY_FUNCTION__, #rwlock, rwlock)
 
#define ast_rwlock_init(rwlock)   __ast_rwlock_init(1, __FILE__, __LINE__, __PRETTY_FUNCTION__, #rwlock, rwlock)
 wrapper for rwlock with tracking enabled More...
 
#define ast_rwlock_init_notracking(rwlock)   __ast_rwlock_init(0, __FILE__, __LINE__, __PRETTY_FUNCTION__, #rwlock, rwlock)
 wrapper for ast_rwlock_init with tracking disabled More...
 
#define AST_RWLOCK_INIT_VALUE   { __AST_RWLOCK_INIT_VALUE, NULL, {1, 0} }
 
#define AST_RWLOCK_INIT_VALUE_NOTRACKING   { __AST_RWLOCK_INIT_VALUE, NULL, {0, 0} }
 
#define ast_rwlock_rdlock(a)   __ast_rwlock_rdlock(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, #a)
 
#define ast_rwlock_timedrdlock(a, b)   __ast_rwlock_timedrdlock(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, #a, b)
 
#define ast_rwlock_timedwrlock(a, b)   __ast_rwlock_timedwrlock(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, #a, b)
 
#define ast_rwlock_tryrdlock(a)   __ast_rwlock_tryrdlock(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, #a)
 
#define ast_rwlock_trywrlock(a)   __ast_rwlock_trywrlock(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, #a)
 
#define ast_rwlock_unlock(a)   __ast_rwlock_unlock(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, #a)
 
#define ast_rwlock_wrlock(a)   __ast_rwlock_wrlock(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, #a)
 
#define CHANNEL_DEADLOCK_AVOIDANCE(chan)
 
#define DEADLOCK_AVOIDANCE(lock)
 
#define DLA_LOCK(lock)   ast_mutex_lock(lock)
 
#define DLA_UNLOCK(lock)   ast_mutex_unlock(lock)
 
#define gethostbyname   __gethostbyname__is__not__reentrant__use__ast_gethostbyname__instead__
 
#define pthread_cond_broadcast   use_ast_cond_broadcast_instead_of_pthread_cond_broadcast
 
#define pthread_cond_destroy   use_ast_cond_destroy_instead_of_pthread_cond_destroy
 
#define pthread_cond_init   use_ast_cond_init_instead_of_pthread_cond_init
 
#define pthread_cond_signal   use_ast_cond_signal_instead_of_pthread_cond_signal
 
#define pthread_cond_t   use_ast_cond_t_instead_of_pthread_cond_t
 
#define pthread_cond_timedwait   use_ast_cond_timedwait_instead_of_pthread_cond_timedwait
 
#define pthread_cond_wait   use_ast_cond_wait_instead_of_pthread_cond_wait
 
#define pthread_create   __use_ast_pthread_create_instead__
 
#define pthread_mutex_destroy   use_ast_mutex_destroy_instead_of_pthread_mutex_destroy
 
#define pthread_mutex_init   use_ast_mutex_init_instead_of_pthread_mutex_init
 
#define PTHREAD_MUTEX_INIT_VALUE   PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
 
#define pthread_mutex_lock   use_ast_mutex_lock_instead_of_pthread_mutex_lock
 
#define pthread_mutex_t   use_ast_mutex_t_instead_of_pthread_mutex_t
 
#define pthread_mutex_trylock   use_ast_mutex_trylock_instead_of_pthread_mutex_trylock
 
#define pthread_mutex_unlock   use_ast_mutex_unlock_instead_of_pthread_mutex_unlock
 
#define ROFFSET   ((lt->reentrancy > 0) ? (lt->reentrancy-1) : 0)
 
#define SCOPED_AO2LOCK(varname, obj)   SCOPED_LOCK(varname, (obj), ao2_lock, ao2_unlock)
 scoped lock specialization for ao2 mutexes. More...
 
#define SCOPED_AO2RDLOCK(varname, obj)   SCOPED_LOCK(varname, (obj), ao2_rdlock, ao2_unlock)
 scoped lock specialization for ao2 read locks. More...
 
#define SCOPED_AO2WRLOCK(varname, obj)   SCOPED_LOCK(varname, (obj), ao2_wrlock, ao2_unlock)
 scoped lock specialization for ao2 write locks. More...
 
#define SCOPED_CHANNELLOCK(varname, chan)   SCOPED_LOCK(varname, (chan), ast_channel_lock, ast_channel_unlock)
 scoped lock specialization for channels. More...
 
#define SCOPED_LOCK(varname, lock, lockfunc, unlockfunc)   RAII_VAR(typeof((lock)), varname, ({lockfunc((lock)); (lock); }), unlockfunc)
 Scoped Locks. More...
 
#define SCOPED_MUTEX(varname, lock)   SCOPED_LOCK(varname, (lock), ast_mutex_lock, ast_mutex_unlock)
 scoped lock specialization for mutexes More...
 
#define SCOPED_RDLOCK(varname, lock)   SCOPED_LOCK(varname, (lock), ast_rwlock_rdlock, ast_rwlock_unlock)
 scoped lock specialization for read locks More...
 
#define SCOPED_WRLOCK(varname, lock)   SCOPED_LOCK(varname, (lock), ast_rwlock_wrlock, ast_rwlock_unlock)
 scoped lock specialization for write locks More...
 

Typedefs

typedef pthread_cond_t ast_cond_t
 
typedef struct ast_mutex_info ast_mutex_t
 
typedef struct ast_rwlock_info ast_rwlock_t
 

Functions

int __ast_cond_broadcast (const char *filename, int lineno, const char *func, const char *cond_name, ast_cond_t *cond)
 
int __ast_cond_destroy (const char *filename, int lineno, const char *func, const char *cond_name, ast_cond_t *cond)
 
int __ast_cond_init (const char *filename, int lineno, const char *func, const char *cond_name, ast_cond_t *cond, pthread_condattr_t *cond_attr)
 
int __ast_cond_signal (const char *filename, int lineno, const char *func, const char *cond_name, ast_cond_t *cond)
 
int __ast_cond_timedwait (const char *filename, int lineno, const char *func, const char *cond_name, const char *mutex_name, ast_cond_t *cond, ast_mutex_t *t, const struct timespec *abstime)
 
int __ast_cond_wait (const char *filename, int lineno, const char *func, const char *cond_name, const char *mutex_name, ast_cond_t *cond, ast_mutex_t *t)
 
int __ast_pthread_mutex_destroy (const char *filename, int lineno, const char *func, const char *mutex_name, ast_mutex_t *t)
 
int __ast_pthread_mutex_init (int tracking, const char *filename, int lineno, const char *func, const char *mutex_name, ast_mutex_t *t)
 
int __ast_pthread_mutex_lock (const char *filename, int lineno, const char *func, const char *mutex_name, ast_mutex_t *t)
 
int __ast_pthread_mutex_trylock (const char *filename, int lineno, const char *func, const char *mutex_name, ast_mutex_t *t)
 
int __ast_pthread_mutex_unlock (const char *filename, int lineno, const char *func, const char *mutex_name, ast_mutex_t *t)
 
int __ast_rwlock_destroy (const char *filename, int lineno, const char *func, const char *rwlock_name, ast_rwlock_t *t)
 
int __ast_rwlock_init (int tracking, const char *filename, int lineno, const char *func, const char *rwlock_name, ast_rwlock_t *t)
 
int __ast_rwlock_rdlock (const char *filename, int lineno, const char *func, ast_rwlock_t *t, const char *name)
 
int __ast_rwlock_timedrdlock (const char *filename, int lineno, const char *func, ast_rwlock_t *t, const char *name, const struct timespec *abs_timeout)
 
int __ast_rwlock_timedwrlock (const char *filename, int lineno, const char *func, ast_rwlock_t *t, const char *name, const struct timespec *abs_timeout)
 
int __ast_rwlock_tryrdlock (const char *filename, int lineno, const char *func, ast_rwlock_t *t, const char *name)
 
int __ast_rwlock_trywrlock (const char *filename, int lineno, const char *func, ast_rwlock_t *t, const char *name)
 
int __ast_rwlock_unlock (const char *filename, int lineno, const char *func, ast_rwlock_t *t, const char *name)
 
int __ast_rwlock_wrlock (const char *filename, int lineno, const char *func, ast_rwlock_t *t, const char *name)
 
#define ast_atomic_fetch_add(ptr, val, memorder)   __atomic_fetch_add((ptr), (val), (memorder))
 Support for atomic instructions. More...
 
#define ast_atomic_add_fetch(ptr, val, memorder)   __atomic_add_fetch((ptr), (val), (memorder))
 
#define ast_atomic_fetch_sub(ptr, val, memorder)   __atomic_fetch_sub((ptr), (val), (memorder))
 
#define ast_atomic_sub_fetch(ptr, val, memorder)   __atomic_sub_fetch((ptr), (val), (memorder))
 
#define ast_atomic_fetch_and(ptr, val, memorder)   __atomic_fetch_and((ptr), (val), (memorder))
 
#define ast_atomic_and_fetch(ptr, val, memorder)   __atomic_and_fetch((ptr), (val), (memorder))
 
#define ast_atomic_fetch_or(ptr, val, memorder)   __atomic_fetch_or((ptr), (val), (memorder))
 
#define ast_atomic_or_fetch(ptr, val, memorder)   __atomic_or_fetch((ptr), (val), (memorder))
 
#define ast_atomic_fetch_xor(ptr, val, memorder)   __atomic_fetch_xor((ptr), (val), (memorder))
 
#define ast_atomic_xor_fetch(ptr, val, memorder)   __atomic_xor_fetch((ptr), (val), (memorder))
 
#define ast_atomic_flag_set(ptr, val, memorder)   ast_atomic_fetch_or((ptr), (val), (memorder))
 
#define ast_atomic_flag_clear(ptr, val, memorder)   ast_atomic_fetch_and((ptr), ~(val), (memorder))
 
int ast_atomic_fetchadd_int (volatile int *p, int v)
 Atomically add v to *p and return the previous value of *p. More...
 
int ast_atomic_dec_and_test (volatile int *p)
 decrement *p by 1 and return true if the variable has reached 0. More...
 

Detailed Description

Asterisk locking-related definitions:

Magic number.

This is used to verify that a pointer is a valid astobj2 or ao2_weak reference.

Note
This field is constant after object creation. It shares a uint32_t with options and lockused.
Warning
Stealing bits for any additional writable fields would cause reentrancy issues if using bitfields. If any additional writable bits are required in the future we will need to put all bitfields into a single 'uint32_t flags' field and use atomic operations from to perform writes.

Definition in file lock.h.

Macro Definition Documentation

◆ __AST_MUTEX_DEFINE

#define __AST_MUTEX_DEFINE (   scope,
  mutex,
  init_val,
  track 
)    scope ast_mutex_t mutex = init_val

Definition at line 515 of file lock.h.

◆ __AST_RWLOCK_DEFINE

#define __AST_RWLOCK_DEFINE (   scope,
  rwlock,
  init_val,
  track 
)    scope ast_rwlock_t rwlock = init_val

Definition at line 538 of file lock.h.

◆ __AST_RWLOCK_INIT_VALUE

#define __AST_RWLOCK_INIT_VALUE   PTHREAD_RWLOCK_INITIALIZER

Definition at line 84 of file lock.h.

Referenced by __ast_rwlock_destroy(), __ast_rwlock_init(), and __ast_rwlock_unlock().

◆ AO2_DEADLOCK_AVOIDANCE

#define AO2_DEADLOCK_AVOIDANCE (   obj)
Value:
ao2_unlock(obj); \
usleep(1); \
ao2_lock(obj);
#define ao2_unlock(a)
Definition: astobj2.h:730

Definition at line 467 of file lock.h.

◆ ast_atomic_add_fetch

#define ast_atomic_add_fetch (   ptr,
  val,
  memorder 
)    __atomic_add_fetch((ptr), (val), (memorder))

Definition at line 668 of file lock.h.

◆ ast_atomic_and_fetch

#define ast_atomic_and_fetch (   ptr,
  val,
  memorder 
)    __atomic_and_fetch((ptr), (val), (memorder))

Definition at line 676 of file lock.h.

◆ ast_atomic_fetch_add

#define ast_atomic_fetch_add (   ptr,
  val,
  memorder 
)    __atomic_fetch_add((ptr), (val), (memorder))

Support for atomic instructions.

These macros implement a uniform interface to use built-in atomic functionality. If available __atomic built-ins are prefered. Legacy __sync built-ins are used as a fallback for older compilers.

Detailed documentation can be found in the GCC manual, all API's are modeled after the __atomic interfaces but using the namespace ast_atomic.

The memorder argument is always ignored by legacy __sync functions. Invalid memorder arguments do not produce errors unless __atomic functions are supported as the argument is erased by the preprocessor.

Note
ast_atomic_fetch_nand and ast_atomic_nand_fetch purposely do not exist. It's implementation was broken prior to gcc-4.4.

Atomic +=

Definition at line 667 of file lock.h.

Referenced by __ao2_ref().

◆ ast_atomic_fetch_and

#define ast_atomic_fetch_and (   ptr,
  val,
  memorder 
)    __atomic_fetch_and((ptr), (val), (memorder))

Atomic &=

Definition at line 675 of file lock.h.

◆ ast_atomic_fetch_or

#define ast_atomic_fetch_or (   ptr,
  val,
  memorder 
)    __atomic_fetch_or((ptr), (val), (memorder))

Atomic |=

Definition at line 679 of file lock.h.

◆ ast_atomic_fetch_sub

#define ast_atomic_fetch_sub (   ptr,
  val,
  memorder 
)    __atomic_fetch_sub((ptr), (val), (memorder))

Atomic -=

Definition at line 671 of file lock.h.

◆ ast_atomic_fetch_xor

#define ast_atomic_fetch_xor (   ptr,
  val,
  memorder 
)    __atomic_fetch_xor((ptr), (val), (memorder))

Atomic xor =

Definition at line 683 of file lock.h.

◆ ast_atomic_flag_clear

#define ast_atomic_flag_clear (   ptr,
  val,
  memorder 
)    ast_atomic_fetch_and((ptr), ~(val), (memorder))

Atomic flag clear

Definition at line 744 of file lock.h.

◆ ast_atomic_flag_set

#define ast_atomic_flag_set (   ptr,
  val,
  memorder 
)    ast_atomic_fetch_or((ptr), (val), (memorder))

Atomic flag set

Definition at line 741 of file lock.h.

◆ ast_atomic_or_fetch

#define ast_atomic_or_fetch (   ptr,
  val,
  memorder 
)    __atomic_or_fetch((ptr), (val), (memorder))

Definition at line 680 of file lock.h.

◆ ast_atomic_sub_fetch

#define ast_atomic_sub_fetch (   ptr,
  val,
  memorder 
)    __atomic_sub_fetch((ptr), (val), (memorder))

Definition at line 672 of file lock.h.

Referenced by ast_atomic_fetchadd_int().

◆ ast_atomic_xor_fetch

#define ast_atomic_xor_fetch (   ptr,
  val,
  memorder 
)    __atomic_xor_fetch((ptr), (val), (memorder))

Definition at line 684 of file lock.h.

◆ ast_cond_broadcast

#define ast_cond_broadcast (   cond)    __ast_cond_broadcast(__FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, cond)

◆ ast_cond_destroy

#define ast_cond_destroy (   cond)    __ast_cond_destroy(__FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, cond)

◆ ast_cond_init

#define ast_cond_init (   cond,
  attr 
)    __ast_cond_init(__FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, cond, attr)

◆ ast_cond_signal

#define ast_cond_signal (   cond)    __ast_cond_signal(__FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, cond)

Definition at line 201 of file lock.h.

Referenced by add_notify(), amihook_helper(), analog_ss_thread(), ast_audiohook_update_status(), ast_audiohook_write_frame(), ast_autoservice_start(), ast_devstate_changed_literal(), ast_log_full(), ast_odbc_release_obj(), ast_sched_add_variable(), ast_sched_del(), ast_sched_runq(), ast_sip_session_unsuspend(), async_callback(), async_play_sound_ready(), autoservice_shutdown(), bridge_channel_impart_ds_head_signal(), bridge_channel_internal_unsuspend_nolock(), bridge_manager_destroy(), bridge_manager_service_req(), calendar_destructor(), chan_test_devicestate_cb(), close_logger(), command_complete(), complex_task(), conf_free(), conf_run(), consumer_exec(), db_sync(), defer_full_frame(), device_state_cb(), device_state_engine_cleanup(), dial_trunk(), dispatch_exec_sync(), dns_synchronous_resolve_callback(), exec_command_on_condition(), hangup_playback(), load_task(), lock_broker(), message_sink_cb(), mixmonitor_ds_destroy(), mock_cdr_backend_cb(), my_decrease_ss_count(), onCallCleared(), onNewCallCreated(), pbx_outgoing_exec(), playback_task(), poke_worker(), pthread_timer_open(), query_set_callback(), recurring_cancel(), resolution_thread(), run_station(), sched_thread_destroy(), schedule_cache_expiration(), schedule_calendar_event(), serializer_shutdown_group_dec(), shutdown_poke(), shutdown_task_exec(), signal_condition(), simple_task(), sip_session_suspend_task(), sla_destroy(), sla_queue_event_full(), softmix_bridge_destroy(), softmix_poke_thread(), sorcery_observer_created(), sorcery_observer_deleted(), sorcery_observer_loaded(), sorcery_observer_updated(), start_batch_mode(), stimulate_attended_transfer(), stop_mixmonitor_full(), stop_poll_thread(), subscription_invoke(), sync_task(), task(), task_1(), test_cancel(), test_emptied(), test_msg_handle_msg_cb(), test_state_changed(), test_sub(), test_task_pushed(), tps_ping_handler(), unbound_config_preapply_callback(), unload_module(), user_event_hook_cb(), and worker_set_state().

◆ ast_cond_timedwait

#define ast_cond_timedwait (   cond,
  mutex,
  time 
)    __ast_cond_timedwait(__FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, #mutex, cond, mutex, time)

◆ ast_cond_wait

#define ast_cond_wait (   cond,
  mutex 
)    __ast_cond_wait(__FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, #mutex, cond, mutex)

◆ AST_LOCK_TRACK_INIT_VALUE

#define AST_LOCK_TRACK_INIT_VALUE   { { NULL }, { 0 }, 0, { NULL }, { 0 }, {{{ 0 }}}, PTHREAD_MUTEX_INIT_VALUE }

Definition at line 90 of file lock.h.

◆ AST_MAX_REENTRANCY

#define AST_MAX_REENTRANCY   10

◆ AST_MUTEX_DEFINE_STATIC

#define AST_MUTEX_DEFINE_STATIC (   mutex)    __AST_MUTEX_DEFINE(static, mutex, AST_MUTEX_INIT_VALUE, 1)

Definition at line 518 of file lock.h.

Referenced by ast_crypt_validate().

◆ AST_MUTEX_DEFINE_STATIC_NOTRACKING

#define AST_MUTEX_DEFINE_STATIC_NOTRACKING (   mutex)    __AST_MUTEX_DEFINE(static, mutex, AST_MUTEX_INIT_VALUE_NOTRACKING, 0)

Definition at line 519 of file lock.h.

◆ ast_mutex_destroy

#define ast_mutex_destroy (   a)    __ast_pthread_mutex_destroy(__FILE__, __LINE__, __PRETTY_FUNCTION__, #a, a)

Definition at line 186 of file lock.h.

Referenced by __ao2_ref(), __ast_internal_context_destroy(), __unload_module(), ast_audiohook_destroy(), ast_autochan_destroy(), ast_bridge_impart(), ast_dial_destroy(), ast_dnsmgr_release(), ast_sched_context_destroy(), ast_sip_push_task_wait(), ast_speech_destroy(), ast_speech_new(), AST_TEST_DEFINE(), async_data_destructor(), async_datastore_data_destroy(), auth_http_callback(), build_conf(), build_gateway(), cel_verify_and_cleanup_cb(), chan_list_destructor(), close_client(), command_dtor(), complex_task_data_free(), conf_free(), data_cleanup(), delete_device(), delete_peers(), delete_users(), destroy_dahdi_pvt(), destroy_endpoint(), destroy_session(), destroy_table(), dispatch_message(), dns_synchronous_resolve_destroy(), do_monitor(), find_idle_thread(), find_realtime(), free_config(), generic_http_callback(), get_lock(), hangup_data_destroy(), iax2_process_thread_cleanup(), init_logger(), load_module(), mgcp_prune_realtime_gateway(), misdn_cfg_destroy(), misdn_jb_destroy(), mixmonitor_free(), odbc_class_destructor(), ooh323_destroy(), ooh323c_call_thread(), ooh323c_start_call_thread(), playback_task_data_destroy(), prometheus_metric_free(), query_set_data_destructor(), recurring_data_destructor(), resolver_data_cleanup(), session_destructor(), session_do(), setup_mixmonitor_ds(), shutdown_data_dtor(), simple_task_data_free(), sla_destroy(), sla_handle_dial_state_event(), sla_station_exec(), smdi_interface_destroy(), softmix_bridge_data_destroy(), softmix_bridge_leave(), sorcery_memory_cache_ami_populate(), start_network_thread(), stasis_message_sink_dtor(), task_data_dtor(), test_shutdown(), timing_read(), unbound_config_preapply_callback(), unistim_free_sub(), unload_module(), vm_allocate_dh(), and worker_thread_destroy().

◆ ast_mutex_init

#define ast_mutex_init (   pmutex)    __ast_pthread_mutex_init(1, __FILE__, __LINE__, __PRETTY_FUNCTION__, #pmutex, pmutex)

Definition at line 184 of file lock.h.

Referenced by accept_thread(), add_notify(), alloc_profile(), alloc_smdi_interface(), ast_audiohook_init(), ast_autochan_setup(), ast_bridge_impart(), ast_context_find_or_create(), ast_dial_create(), ast_dns_resolve(), ast_dnsmgr_get_family(), ast_query_set_resolve(), ast_sched_context_create(), ast_sip_push_task_wait(), ast_speech_new(), AST_TEST_DEFINE(), async_data_alloc(), async_datastore_data_alloc(), auth_http_callback(), available(), build_conf(), build_device(), build_gateway(), build_mansession(), build_peer(), build_user(), caldav_load_calendar(), command_create(), complex_task_data_alloc(), conf_run(), config_device(), config_line(), config_parse_variables(), create_client(), dispatch_message(), duplicate_pseudo(), ewscal_load_calendar(), exchangecal_load_calendar(), find_idle_thread(), find_table(), find_tpeer(), generic_http_callback(), get_lock(), hangup_data_init(), ical_load_calendar(), init_logger(), init_timing_thread(), internal_ao2_alloc(), load_config(), load_module(), load_odbc_config(), mbl_load_device(), misdn_cfg_init(), misdn_jb_init(), mkintf(), ooh323_alloc(), ooh323c_start_call_thread(), parse_config(), playback_task_data_init(), prometheus_metric_create(), query_set_data_alloc(), rcv_mac_addr(), read_config(), recurring_data_alloc(), resolver_data_init(), scheduler(), session_do(), setup_mixmonitor_ds(), shutdown_data_create(), simple_task_data_alloc(), sla_handle_dial_state_event(), sla_load_config(), sla_station_exec(), softmix_bridge_create(), softmix_bridge_join(), sorcery_memory_cache_ami_populate(), start_network_thread(), stasis_message_sink_create(), task_data_create(), test_alloc(), test_cel_init_cb(), unbound_config_preapply_callback(), unistim_alloc_sub(), vm_allocate_dh(), and worker_thread_alloc().

◆ ast_mutex_init_notracking

#define ast_mutex_init_notracking (   pmutex)    __ast_pthread_mutex_init(0, __FILE__, __LINE__, __PRETTY_FUNCTION__, #pmutex, pmutex)

Definition at line 185 of file lock.h.

◆ AST_MUTEX_INIT_VALUE

#define AST_MUTEX_INIT_VALUE   { PTHREAD_MUTEX_INIT_VALUE, NULL, {1, 0} }

Definition at line 95 of file lock.h.

◆ AST_MUTEX_INIT_VALUE_NOTRACKING

#define AST_MUTEX_INIT_VALUE_NOTRACKING   { PTHREAD_MUTEX_INIT_VALUE, NULL, {0, 0} }

Definition at line 96 of file lock.h.

◆ AST_MUTEX_INITIALIZER

#define AST_MUTEX_INITIALIZER   __use_AST_MUTEX_DEFINE_STATIC_rather_than_AST_MUTEX_INITIALIZER__

Definition at line 635 of file lock.h.

◆ AST_MUTEX_KIND

#define AST_MUTEX_KIND   PTHREAD_MUTEX_RECURSIVE_NP

Definition at line 77 of file lock.h.

Referenced by __ast_pthread_mutex_init(), and dummy_start().

◆ ast_mutex_lock

#define ast_mutex_lock (   a)    __ast_pthread_mutex_lock(__FILE__, __LINE__, __PRETTY_FUNCTION__, #a, a)

Definition at line 187 of file lock.h.

Referenced by __attempt_transmit(), __auth_reject(), __auto_congest(), __auto_hangup(), __dahdi_exception(), __find_callno(), __get_from_jb(), __iax2_poke_noanswer(), __manager_event_sessions_va(), __reload(), __unload_module(), _ast_odbc_request_obj2(), acf_channel_read(), acf_jabberreceive_read(), acl_change_stasis_cb(), action_dahdishowchannels(), action_waitevent(), add_notify(), adsi_delete(), adsi_message(), alsa_answer(), alsa_call(), alsa_digit(), alsa_fixup(), alsa_hangup(), alsa_indicate(), alsa_read(), alsa_request(), alsa_text(), alsa_write(), amihook_helper(), analog_ss_thread(), announce_thread(), answer_exec_run(), app_exec(), append_mailbox_mapping(), ast_ari_remove_handler(), ast_autochan_new_channel(), ast_begin_shutdown(), ast_cancel_shutdown(), ast_cli_netstats(), ast_context_lockmacro(), ast_db_del(), ast_db_deltree(), ast_db_gettree(), ast_db_gettree_by_prefix(), ast_db_put(), ast_dial_join(), ast_dns_get_nameservers(), ast_dns_resolve(), ast_dnsmgr_changed(), ast_file_read_dirs(), ast_get_enum(), ast_iax2_new(), ast_merge_contexts_and_delete(), ast_monitor_start(), ast_odbc_direct_execute(), ast_odbc_prepare_and_execute(), ast_odbc_release_obj(), ast_pjproject_log_intercept_begin(), ast_query_set_resolve(), ast_random(), ast_rdlock_contexts(), ast_replace_sigchld(), ast_sched_add_variable(), ast_sched_clean_by_callback(), ast_sched_context_destroy(), ast_sched_del(), ast_sched_dump(), ast_sched_find_data(), ast_sched_report(), ast_sched_runq(), ast_sched_wait(), ast_sched_when(), ast_search_dns(), ast_sip_push_task_wait(), ast_smdi_md_message_push(), ast_smdi_mwi_message_push(), AST_TEST_DEFINE(), ast_unreplace_sigchld(), ast_verb_update(), ast_wrlock_contexts(), astdb_atexit(), async_callback(), async_play_sound_ready(), attempt_transfer(), auth_reject(), authenticate_reply(), auto_hangup(), blr_ebl(), blr_txt(), bridge_agent_hold_deferred_create(), bridge_channel_impart_ds_head_signal(), bridge_channel_impart_wait(), build_device(), build_reply_digest(), caldav_load_calendar(), can_safely_quit(), cb_events(), cdr_detach(), cdr_handler(), cdr_submit_batch(), chan_test_devicestate_cb(), channel_to_session(), check_unloading(), cl_dequeue_chan(), cl_queue_chan(), clear_history_entries(), clear_result_states(), clear_talking(), cli_tps_ping(), close_client(), close_mailbox(), close_rtp_connection(), close_udptl_connection(), command_complete(), command_join(), conf_free(), conf_run(), config_device(), config_handler(), config_line(), config_load(), config_module(), config_pgsql(), console_answer(), console_autoanswer(), console_dial(), console_hangup(), console_sendtext(), create_channel_name(), create_client(), csv_log(), custom_log(), dahdi_answer(), dahdi_call(), dahdi_cc_callback(), dahdi_create_channel_range(), dahdi_destroy_channel_range(), dahdi_digit_begin(), dahdi_digit_end(), dahdi_exception(), dahdi_fixup(), dahdi_func_read(), dahdi_func_write(), dahdi_handle_dtmf(), dahdi_handle_event(), dahdi_hangup(), dahdi_iflist_extract(), dahdi_indicate(), dahdi_master_slave_unlink(), dahdi_request(), dahdi_restart(), dahdi_sendtext(), dahdi_set_dnd(), dahdi_set_hwgain(), dahdi_set_swgain(), dahdi_show_channel(), dahdi_show_channels(), dahdi_softhangup_all(), dahdi_write(), db_create_astdb(), db_get_common(), db_open(), db_sync_thread(), decrease_call_count(), defer_full_frame(), DEFINE_SQL_STATEMENT(), delete_peers(), delete_users(), destroy_all_channels(), destroy_all_mailbox_mappings(), destroy_conference_bridge(), destroy_endpoint(), destroy_monitor_audiohook(), destroy_pgsql(), destroy_session(), destroy_table(), device_state_cb(), dial_trunk(), dispatch_exec_sync(), dispatch_message(), dns_advance_field(), dns_synchronous_resolve_callback(), dnsmgr_refresh(), do_cdr(), do_discovery(), do_monitor(), do_monitor_headset(), do_monitor_phone(), do_refresh(), do_reload(), do_timing(), dp_lookup(), dump_cmd_queues(), dump_queue(), ewscal_load_calendar(), exchangecal_load_calendar(), filter_history(), find_call(), find_chan_by_bc(), find_channel(), find_command(), find_database(), find_friend(), find_hold_active_call(), find_hold_call(), find_hold_call_l3(), find_idle_thread(), find_peer(), find_subchannel_and_lock(), find_subchannel_by_name(), find_table(), find_tpeer(), find_user(), finish_bookmark(), function_ooh323_read(), function_ooh323_write(), generate_uuid(), generic_http_callback(), get_chan_by_ast_name(), get_dial_bridge(), get_input(), get_lock(), get_unused_callno(), handle_capabilities_res_message(), handle_clear_alarms(), handle_cli_database_query(), handle_cli_database_show(), handle_cli_database_showkey(), handle_cli_dialplan_save(), handle_cli_iax2_show_channels(), handle_cli_iax2_show_stats(), handle_cli_misdn_show_channel(), handle_cli_misdn_show_channels(), handle_cli_mobile_cusd(), handle_cli_mobile_rfcomm(), handle_cli_mobile_show_devices(), handle_cli_odbc_show(), handle_cli_ooh323_reload(), handle_cli_ooh323_show_peer(), handle_cli_ooh323_show_peers(), handle_cli_ooh323_show_user(), handle_cli_ooh323_show_users(), handle_cli_osp_show(), handle_cli_realtime_pgsql_status(), handle_deferred_full_frames(), handle_init_event(), handle_mgcp_audit_endpoint(), handle_mgcp_show_endpoints(), handle_modlist(), handle_request(), handle_request_do(), handle_speechrecognize(), handler_wait_for_message(), hangup_playback(), headset_send_ring(), history_on_rx_msg(), history_on_tx_msg(), http_callback(), iax2_call(), iax2_do_register(), iax2_fixup(), iax2_hangup(), iax2_indicate(), iax2_key_rotate(), iax2_lock_callno_unless_destroyed(), iax2_poke_peer(), iax2_process_thread(), iax2_queryoption(), iax2_setoption(), iax2_write(), iax_process_template(), iax_prov_complete_template(), iax_provision_build(), iax_provision_free_templates(), iax_provision_version(), iax_show_provisioning(), iax_template_parse(), ical_load_calendar(), increase_call_count(), inotify_daemon(), key_main_page(), key_select_extension(), leave_voicemail(), load_config(), load_module(), load_values_config(), lock_broker(), lock_it(), lock_msg_q(), log_jitterstats(), lua_free_extensions(), lua_load_extensions(), lua_reload_extensions(), make_trunk(), mansession_lock(), mb_poll_thread(), mbl_answer(), mbl_call(), mbl_devicestate(), mbl_digit_end(), mbl_fixup(), mbl_hangup(), mbl_request(), mbl_sendsms_exec(), mbl_status_exec(), meetme_menu_admin_extended(), mgcp_answer(), mgcp_call(), mgcp_devicestate(), mgcp_fixup(), mgcp_hangup(), mgcp_indicate(), mgcp_pktcgate_open(), mgcp_pktcgate_remove(), mgcp_postrequest(), mgcp_prune_realtime_gateway(), mgcp_read(), mgcp_reload(), mgcp_senddigit_begin(), mgcp_senddigit_end(), mgcp_write(), mgcpsock_read(), mid_test_sync(), misdn_cfg_lock(), misdn_chan_is_valid(), misdn_hangup(), misdn_jb_empty(), misdn_jb_fill(), misdn_overlap_dial_task(), mixmonitor_ds_destroy(), mixmonitor_thread(), mwi_monitor_handler(), my_decrease_ss_count(), my_handle_dtmf(), my_increase_ss_count(), my_lock_private(), MYSQL_exec(), mysql_log(), native_bridge_is_capable(), native_start(), native_stop(), onAlerting(), onCallCleared(), onCallEstablished(), onModeChanged(), onNewCallCreated(), onOutgoingCall(), onProgress(), ooh323_alloc(), ooh323_answer(), ooh323_call(), ooh323_delete_peer(), ooh323_destroy(), ooh323_digit_begin(), ooh323_digit_end(), ooh323_do_reload(), ooh323_fixup(), ooh323_hangup(), ooh323_indicate(), ooh323_new(), ooh323_onReceivedDigit(), ooh323_onReceivedSetup(), ooh323_queryoption(), ooh323_read(), ooh323_request(), ooh323_set_read_format(), ooh323_set_rtp_peer(), ooh323_set_write_format(), ooh323_write(), ooh323c_call_thread(), ooh323c_start_call_thread(), osp_create_provider(), osp_create_transaction(), osp_get_provider(), osp_unload(), parse_config(), parsing(), pbx_load_module(), peer_destructor(), pgsql_log(), phone_request(), pjsip_show_history(), play_message(), play_message_by_id_helper(), play_sound_helper(), playback_task(), presence_state_cb(), private_enum_init(), prometheus_scrape_to_string(), prune_gateways(), pthread_timer_open(), publish_msg(), pvt_destructor(), query_set_callback(), query_set_test(), queue_ringing_trunk(), rcv_mac_addr(), realtime_destroy_handler(), realtime_handler(), realtime_ldap_base_ap(), realtime_multi_handler(), realtime_multi_pgsql(), realtime_pgsql(), realtime_store_handler(), realtime_update2_handler(), realtime_update_handler(), recordthread(), recurring_cancel(), register_verify(), registry_authrequest(), release_chan(), release_chan_early(), reload(), reload_config(), reload_followme(), reload_module(), replace_callno(), reqprep(), require_pgsql(), resolution_thread(), restart_monitor(), restart_pktc_thread(), retrans_pkt(), run_station(), save_to_folder(), sched_run(), sched_thread_destroy(), schedule_cache_expiration(), schedule_calendar_event(), scheduled_destroy(), sco_accept(), scrape_metrics(), send_client(), send_command_locked(), send_request(), send_retransmit(), set_hangup_source_and_cause(), set_pvt_defaults(), set_softmix_bridge_data(), set_unloading(), setup_dahdi_int(), setup_rtp_connection(), setup_rtp_remote(), setup_udptl_connection(), signal_condition(), sip_reload(), sip_show_settings(), skinny_session(), sla_destroy(), sla_handle_dial_state_event(), sla_handle_ringing_trunk_event(), sla_hangup_stations(), sla_queue_event_full(), sla_station_exec(), sla_thread(), sla_trunk_exec(), socket_process_helper(), softmix_bridge_destroy(), softmix_bridge_stop(), softmix_bridge_write_rtcp(), softmix_bridge_write_video(), softmix_bridge_write_voice(), softmix_mixing_loop(), softmix_mixing_thread(), softmix_poke_thread(), sorcery_memory_cache_ami_populate(), spandsp_fax_cli_show_stats(), speech_background(), start_batch_mode(), start_network_thread(), start_rtp(), stasis_app_control_shutdown(), stop_mixmonitor_full(), stop_poll_thread(), store_pgsql(), stun_monitor_request(), stun_stop_monitor(), sync_task(), syslog_log(), task_1(), tds_load_module(), tds_log(), tds_unload_module(), test_cancel(), test_msg_handle_msg_cb(), timing_read(), tps_ping_handler(), transmit_frame(), transmit_response_bysession(), unbound_config_preapply_callback(), unistim_fixup(), unistim_hangup_clean(), unistim_read(), unistim_register(), unistim_show_devices(), unistim_show_info(), unistim_write(), unistimsock_read(), unload_module(), update2_ldap(), update2_pgsql(), update_pgsql(), update_registry(), user_event_hook_cb(), user_event_wait_for_events(), vm_allocate_dh(), vm_execmain(), vm_instructions_en(), vm_instructions_ja(), wait_for_channel_callback(), wait_for_device_state_updates(), wait_for_hook(), wait_for_initiator(), wait_for_resolution(), wait_until_thread_state_task_pushed(), worker_start(), write_cel(), and xmpp_pak_message().

◆ ast_mutex_trylock

#define ast_mutex_trylock (   a)    __ast_pthread_mutex_trylock(__FILE__, __LINE__, __PRETTY_FUNCTION__, #a, a)

◆ ast_mutex_unlock

#define ast_mutex_unlock (   a)    __ast_pthread_mutex_unlock(__FILE__, __LINE__, __PRETTY_FUNCTION__, #a, a)

Definition at line 188 of file lock.h.

Referenced by __attempt_transmit(), __auth_reject(), __auto_congest(), __auto_hangup(), __dahdi_exception(), __find_callno(), __get_from_jb(), __iax2_poke_noanswer(), __manager_event_sessions_va(), __reload(), __send_lagrq(), __send_ping(), __unload_module(), _ast_odbc_request_obj2(), acf_channel_read(), acf_jabberreceive_read(), acl_change_stasis_cb(), action_dahdishowchannels(), action_waitevent(), add_notify(), adsi_delete(), adsi_message(), alsa_answer(), alsa_call(), alsa_digit(), alsa_fixup(), alsa_hangup(), alsa_indicate(), alsa_read(), alsa_request(), alsa_text(), alsa_write(), amihook_helper(), analog_ss_thread(), announce_thread(), answer_exec_run(), app_exec(), append_mailbox_mapping(), ast_ari_remove_handler(), ast_autochan_new_channel(), ast_begin_shutdown(), ast_cancel_shutdown(), ast_change_hint(), ast_cli_netstats(), ast_cli_perms_init(), ast_context_unlockmacro(), ast_db_del(), ast_db_deltree(), ast_db_gettree(), ast_db_gettree_by_prefix(), ast_db_put(), ast_dial_join(), ast_dns_get_nameservers(), ast_dns_resolve(), ast_dnsmgr_changed(), ast_file_read_dirs(), ast_get_enum(), ast_iax2_new(), ast_merge_contexts_and_delete(), ast_module_reload(), ast_monitor_start(), ast_odbc_direct_execute(), ast_odbc_prepare_and_execute(), ast_odbc_release_obj(), ast_pjproject_log_intercept_end(), ast_query_set_resolve(), ast_random(), ast_replace_sigchld(), ast_sched_add_variable(), ast_sched_clean_by_callback(), ast_sched_context_destroy(), ast_sched_del(), ast_sched_dump(), ast_sched_find_data(), ast_sched_report(), ast_sched_runq(), ast_sched_wait(), ast_sched_when(), ast_search_dns(), ast_sip_push_task_wait(), ast_smdi_md_message_push(), ast_smdi_mwi_message_push(), AST_TEST_DEFINE(), ast_unlock_contexts(), ast_unreplace_sigchld(), ast_verb_update(), astdb_atexit(), async_callback(), async_play_sound_ready(), attempt_transfer(), auth_reject(), authenticate_reply(), auto_hangup(), blr_ebl(), blr_txt(), bridge_agent_hold_deferred_create(), bridge_channel_impart_ds_head_signal(), bridge_channel_impart_wait(), build_device(), build_reply_digest(), cache_get_callno_locked(), caldav_load_calendar(), can_safely_quit(), cb_events(), cdr_detach(), cdr_handler(), cdr_submit_batch(), chan_test_devicestate_cb(), channel_to_session(), check_unloading(), cl_dequeue_chan(), cl_queue_chan(), clear_history_entries(), clear_result_states(), clear_talking(), cli_tps_ping(), close_client(), close_mailbox(), close_rtp_connection(), close_udptl_connection(), command_complete(), command_join(), conf_free(), conf_run(), config_device(), config_handler(), config_line(), config_load(), config_module(), config_pgsql(), configure_local_rtp(), console_answer(), console_autoanswer(), console_dial(), console_hangup(), console_sendtext(), create_channel_name(), create_client(), csv_log(), custom_log(), dahdi_answer(), dahdi_call(), dahdi_cc_callback(), dahdi_create_channel_range(), dahdi_destroy_channel_range(), dahdi_digit_begin(), dahdi_digit_end(), dahdi_exception(), dahdi_fixup(), dahdi_func_read(), dahdi_func_write(), dahdi_handle_dtmf(), dahdi_handle_event(), dahdi_hangup(), dahdi_iflist_extract(), dahdi_indicate(), dahdi_master_slave_unlink(), dahdi_read(), dahdi_request(), dahdi_restart(), dahdi_sendtext(), dahdi_set_dnd(), dahdi_set_hwgain(), dahdi_set_swgain(), dahdi_show_channel(), dahdi_show_channels(), dahdi_softhangup_all(), dahdi_write(), db_create_astdb(), db_get_common(), db_open(), db_sync_thread(), decrease_call_count(), defer_full_frame(), DEFINE_SQL_STATEMENT(), delete_peers(), delete_users(), destroy_all_channels(), destroy_all_mailbox_mappings(), destroy_conference_bridge(), destroy_endpoint(), destroy_monitor_audiohook(), destroy_pgsql(), destroy_session(), destroy_table(), device_state_cb(), dial_trunk(), dispatch_exec_sync(), dispatch_message(), dns_advance_field(), dns_synchronous_resolve_callback(), dnsmgr_refresh(), do_cdr(), do_discovery(), do_monitor(), do_monitor_headset(), do_monitor_phone(), do_refresh(), do_reload(), do_timing(), dp_lookup(), dump_cmd_queues(), dump_queue(), ewscal_load_calendar(), exchangecal_load_calendar(), filter_history(), find_cache(), find_call(), find_chan_by_bc(), find_channel(), find_command(), find_friend(), find_hold_active_call(), find_hold_call(), find_hold_call_l3(), find_idle_thread(), find_peer(), find_subchannel_and_lock(), find_subchannel_by_name(), find_table(), find_user(), finish_bookmark(), function_ooh323_read(), function_ooh323_write(), generate_uuid(), generic_http_callback(), get_chan_by_ast_name(), get_dial_bridge(), get_input(), get_lock(), get_unused_callno(), handle_capabilities_res_message(), handle_clear_alarms(), handle_cli_database_query(), handle_cli_database_show(), handle_cli_database_showkey(), handle_cli_dialplan_save(), handle_cli_iax2_show_channels(), handle_cli_iax2_show_stats(), handle_cli_misdn_show_channel(), handle_cli_misdn_show_channels(), handle_cli_mobile_cusd(), handle_cli_mobile_rfcomm(), handle_cli_mobile_show_devices(), handle_cli_odbc_show(), handle_cli_ooh323_reload(), handle_cli_ooh323_show_peer(), handle_cli_ooh323_show_peers(), handle_cli_ooh323_show_user(), handle_cli_ooh323_show_users(), handle_cli_osp_show(), handle_cli_realtime_pgsql_status(), handle_deferred_full_frames(), handle_init_event(), handle_mgcp_audit_endpoint(), handle_mgcp_show_endpoints(), handle_modlist(), handle_request(), handle_request_do(), handle_speechrecognize(), handler_wait_for_message(), hangup_playback(), headset_send_ring(), history_on_rx_msg(), history_on_tx_msg(), http_callback(), iax2_call(), iax2_do_register(), iax2_fixup(), iax2_hangup(), iax2_indicate(), iax2_key_rotate(), iax2_lock_callno_unless_destroyed(), iax2_poke_peer(), iax2_process_thread(), iax2_provision(), iax2_queryoption(), iax2_request(), iax2_setoption(), iax2_trunk_queue(), iax2_write(), iax_process_template(), iax_prov_complete_template(), iax_provision_build(), iax_provision_free_templates(), iax_provision_version(), iax_show_provisioning(), iax_template_parse(), ical_load_calendar(), increase_call_count(), inotify_daemon(), key_main_page(), key_select_extension(), ldap_loadentry(), leave_voicemail(), load_config(), load_module(), load_values_config(), lock_broker(), log_jitterstats(), lua_free_extensions(), lua_load_extensions(), lua_reload_extensions(), make_trunk(), mansession_unlock(), mb_poll_thread(), mbl_answer(), mbl_call(), mbl_devicestate(), mbl_digit_end(), mbl_fixup(), mbl_hangup(), mbl_read(), mbl_request(), mbl_sendsms_exec(), mbl_status_exec(), mbl_write(), meetme_menu_admin_extended(), mgcp_answer(), mgcp_call(), mgcp_devicestate(), mgcp_fixup(), mgcp_hangup(), mgcp_indicate(), mgcp_pktcgate_open(), mgcp_pktcgate_remove(), mgcp_postrequest(), mgcp_prune_realtime_gateway(), mgcp_read(), mgcp_reload(), mgcp_request(), mgcp_senddigit_begin(), mgcp_senddigit_end(), mgcp_write(), mgcpsock_read(), mid_test_sync(), misdn_cfg_unlock(), misdn_chan_is_valid(), misdn_hangup(), misdn_jb_empty(), misdn_jb_fill(), misdn_overlap_dial_task(), mixmonitor_ds_destroy(), mixmonitor_thread(), mwi_monitor_handler(), my_decrease_ss_count(), my_handle_dtmf(), my_increase_ss_count(), my_unlock_private(), MYSQL_exec(), mysql_log(), native_bridge_is_capable(), native_start(), native_stop(), onAlerting(), onCallCleared(), onCallEstablished(), onModeChanged(), onNewCallCreated(), onOutgoingCall(), onProgress(), ooh323_alloc(), ooh323_answer(), ooh323_call(), ooh323_delete_peer(), ooh323_destroy(), ooh323_digit_begin(), ooh323_digit_end(), ooh323_do_reload(), ooh323_fixup(), ooh323_hangup(), ooh323_indicate(), ooh323_new(), ooh323_onReceivedDigit(), ooh323_onReceivedSetup(), ooh323_queryoption(), ooh323_read(), ooh323_request(), ooh323_set_read_format(), ooh323_set_rtp_peer(), ooh323_set_write_format(), ooh323_write(), ooh323c_call_thread(), ooh323c_start_call_thread(), osp_create_provider(), osp_create_transaction(), osp_get_provider(), osp_unload(), parse_config(), parsing(), pbx_load_module(), peer_destructor(), pgsql_log(), phone_request(), pjsip_show_history(), play_message(), play_message_by_id_helper(), play_sound_helper(), playback_task(), presence_state_cb(), private_enum_init(), prometheus_scrape_to_string(), prune_gateways(), pthread_timer_open(), publish_msg(), pvt_destructor(), query_set_callback(), query_set_test(), queue_ringing_trunk(), rcv_mac_addr(), realtime_destroy_handler(), realtime_handler(), realtime_ldap_base_ap(), realtime_multi_handler(), realtime_multi_pgsql(), realtime_pgsql(), realtime_store_handler(), realtime_update2_handler(), realtime_update_handler(), recordthread(), recurring_cancel(), refresh_list(), register_verify(), registry_authrequest(), release_chan(), release_chan_early(), release_table(), reload(), reload_config(), reload_followme(), reload_module(), replace_callno(), reqprep(), require_pgsql(), resolution_thread(), restart_monitor(), restart_pktc_thread(), retrans_pkt(), run_station(), save_to_folder(), sched_run(), sched_thread_destroy(), schedule_cache_expiration(), schedule_calendar_event(), scheduled_destroy(), sco_accept(), scrape_metrics(), send_client(), send_command_locked(), send_request(), send_retransmit(), set_hangup_source_and_cause(), set_pvt_defaults(), set_softmix_bridge_data(), set_unloading(), setup_dahdi_int(), setup_rtp_connection(), setup_rtp_remote(), setup_udptl_connection(), signal_condition(), sip_reload(), sip_show_settings(), skinny_session(), skinny_session_cleanup(), sla_destroy(), sla_handle_dial_state_event(), sla_handle_ringing_trunk_event(), sla_hangup_stations(), sla_queue_event_full(), sla_station_exec(), sla_thread(), sla_trunk_exec(), socket_process_helper(), socket_process_meta(), softmix_bridge_destroy(), softmix_bridge_stop(), softmix_bridge_write_rtcp(), softmix_bridge_write_video(), softmix_bridge_write_voice(), softmix_mixing_loop(), softmix_mixing_thread(), softmix_poke_thread(), sorcery_memory_cache_ami_populate(), spandsp_fax_cli_show_stats(), speech_background(), start_batch_mode(), start_network_thread(), start_rtp(), stasis_app_control_shutdown(), stop_mixmonitor_full(), stop_poll_thread(), store_pgsql(), stun_monitor_request(), stun_stop_monitor(), sync_task(), syslog_log(), task_1(), tds_load_module(), tds_log(), tds_unload_module(), test_cancel(), test_msg_handle_msg_cb(), timing_read(), tps_ping_handler(), transmit_frame(), transmit_response_bysession(), unbound_config_preapply_callback(), unistim_fixup(), unistim_hangup_clean(), unistim_read(), unistim_register(), unistim_show_devices(), unistim_show_info(), unistim_write(), unistimsock_read(), unload_module(), unlock_it(), unlock_msg_q(), update2_ldap(), update2_pgsql(), update_pgsql(), update_registry(), user_event_hook_cb(), user_event_wait_for_events(), vm_allocate_dh(), vm_execmain(), vm_instructions_en(), vm_instructions_ja(), wait_for_channel_callback(), wait_for_device_state_updates(), wait_for_hook(), wait_for_initiator(), wait_for_resolution(), wait_until_thread_state_task_pushed(), worker_start(), write_cel(), and xmpp_pak_message().

◆ AST_PTHREADT_NULL

#define AST_PTHREADT_NULL   (pthread_t) -1
Examples:
/tmp/asterisk-shallow/main/app.c.

Definition at line 66 of file lock.h.

Referenced by __allocate_taskprocessor(), __ast_rwlock_unlock(), __manager_event_sessions_va(), __sip_reliable_xmit(), __unload_module(), accept_thread(), action_dahdishowchannels(), action_waitevent(), actual_load_config(), add_notify(), ast_autoservice_start(), ast_autoservice_stop(), ast_console_puts_mutable_full(), ast_devstate_changed_literal(), ast_dial_create(), ast_dial_join(), ast_localtime_wakeup_monitor(), ast_log_full(), ast_pjproject_log_intercept_end(), ast_safe_fork(), ast_sched_start_thread(), ast_sip_destroy_transport_management(), ast_taskprocessor_execute(), ast_tcptls_server_start(), ast_tcptls_server_stop(), ast_xmpp_client_disconnect(), autoservice_run(), autoservice_shutdown(), bridge_manager_create(), bridge_manager_destroy(), build_calendar(), build_conf(), build_mansession(), calendar_event_notify(), cdr_enable_batch_mode(), cdr_submit_batch(), cleanup_module(), close_logger(), conf_free(), conf_run(), dahdi_cc_callback(), dahdi_destroy_channel_range(), dahdi_restart(), default_listener_pvt_alloc(), default_listener_shutdown(), destroy_session(), device_state_engine_cleanup(), do_reload(), expiration_global_loaded(), finalize_batch_mode(), generic_http_callback(), get_input(), handle_call_outgoing(), init_pvt(), inotify_daemon(), keepalive_global_loaded(), load_module(), mbl_load_device(), meetme_menu_admin_extended(), moh_class_destructor(), monitor_sig_flags(), ooh323c_stop_call_thread(), ooh323c_stop_stack_thread(), really_quit(), restart_monitor(), restart_pktc_thread(), sched_thread_destroy(), setup_dahdi_int(), sla_destroy(), sla_load_config(), sla_queue_event_full(), smdi_interface_destroy(), smdi_load(), softmix_bridge_create(), softmix_bridge_destroy(), sorcery_memory_cache_thrash_create(), sorcery_memory_cache_thrash_stop(), start_monitor(), stop_poll_thread(), stop_stream(), unbound_resolver_alloc(), unbound_resolver_start(), unbound_resolver_stop(), unistim_alloc_sub(), unload_module(), worker_shutdown(), worker_thread_alloc(), and xmpp_client_alloc().

◆ AST_PTHREADT_STOP

#define AST_PTHREADT_STOP   (pthread_t) -2

◆ AST_RWLOCK_DEFINE_STATIC

#define AST_RWLOCK_DEFINE_STATIC (   rwlock)    __AST_RWLOCK_DEFINE(static, rwlock, AST_RWLOCK_INIT_VALUE, 1)

Definition at line 541 of file lock.h.

◆ AST_RWLOCK_DEFINE_STATIC_NOTRACKING

#define AST_RWLOCK_DEFINE_STATIC_NOTRACKING (   rwlock)    __AST_RWLOCK_DEFINE(static, rwlock, AST_RWLOCK_INIT_VALUE_NOTRACKING, 0)

Definition at line 542 of file lock.h.

◆ ast_rwlock_destroy

#define ast_rwlock_destroy (   rwlock)    __ast_rwlock_destroy(__FILE__, __LINE__, __PRETTY_FUNCTION__, #rwlock, rwlock)

◆ ast_rwlock_init

#define ast_rwlock_init (   rwlock)    __ast_rwlock_init(1, __FILE__, __LINE__, __PRETTY_FUNCTION__, #rwlock, rwlock)

◆ ast_rwlock_init_notracking

#define ast_rwlock_init_notracking (   rwlock)    __ast_rwlock_init(0, __FILE__, __LINE__, __PRETTY_FUNCTION__, #rwlock, rwlock)

wrapper for ast_rwlock_init with tracking disabled

Returns
0 on success, non zero for error
Since
1.6.1

Definition at line 229 of file lock.h.

◆ AST_RWLOCK_INIT_VALUE

#define AST_RWLOCK_INIT_VALUE   { __AST_RWLOCK_INIT_VALUE, NULL, {1, 0} }

Definition at line 98 of file lock.h.

◆ AST_RWLOCK_INIT_VALUE_NOTRACKING

#define AST_RWLOCK_INIT_VALUE_NOTRACKING   { __AST_RWLOCK_INIT_VALUE, NULL, {0, 0} }

Definition at line 99 of file lock.h.

◆ ast_rwlock_rdlock

#define ast_rwlock_rdlock (   a)    __ast_rwlock_rdlock(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, #a)

Definition at line 233 of file lock.h.

Referenced by _ast_hashtab_start_traversal(), action_messagesend(), allowed_on_shutdown(), ast_adsi_available(), ast_adsi_begin_download(), ast_adsi_channel_restore(), ast_adsi_clear_screen(), ast_adsi_clear_soft_keys(), ast_adsi_connect_session(), ast_adsi_data_mode(), ast_adsi_disconnect_session(), ast_adsi_display(), ast_adsi_download_connect(), ast_adsi_download_disconnect(), ast_adsi_end_download(), ast_adsi_get_cpeid(), ast_adsi_get_cpeinfo(), ast_adsi_input_control(), ast_adsi_input_format(), ast_adsi_load_session(), ast_adsi_load_soft_key(), ast_adsi_print(), ast_adsi_query_cpeid(), ast_adsi_query_cpeinfo(), ast_adsi_read_encoded_dtmf(), ast_adsi_set_keys(), ast_adsi_set_line(), ast_adsi_transmit_message(), ast_adsi_transmit_message_full(), ast_adsi_unload_session(), ast_adsi_voice_mode(), ast_calendar_config_acquire(), ast_hashtab_get_stats(), ast_hashtab_lookup(), ast_hashtab_lookup_with_hash(), ast_hashtab_rdlock(), ast_msg_has_destination(), ast_msg_send(), ast_rdlock_context(), ast_rtp_codecs_find_payload_code(), ast_rtp_codecs_get_framing(), ast_rtp_codecs_get_payload(), ast_rtp_codecs_get_payload_format(), ast_rtp_codecs_get_stream_type(), ast_rtp_codecs_payload_code(), ast_rtp_codecs_payload_code_tx(), ast_rtp_codecs_payload_formats(), ast_rtp_codecs_payloads_set_m_type(), ast_rtp_codecs_payloads_set_rtpmap_type_rate(), ast_rtp_lookup_mime_subtype2(), ast_rtp_lookup_sample_rate2(), ast_str_retrieve_variable(), ast_taskprocessor_alert_get(), beanstalk_put(), cel_bs_put(), codec_to_index(), corosync_show_config(), cpg_confchg_cb(), cpg_deliver_cb(), find_table(), get_active_pvt(), get_general_options(), get_odbc_obj(), get_subscription(), handle_msg_cb(), handle_show_globals(), has_destination_cb(), index2codec(), manager_log(), msg_q_cb(), msg_send_exec(), pbx_builtin_getvar_helper(), and rtp_learning_start().

◆ ast_rwlock_timedrdlock

#define ast_rwlock_timedrdlock (   a,
  b 
)    __ast_rwlock_timedrdlock(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, #a, b)

Definition at line 237 of file lock.h.

◆ ast_rwlock_timedwrlock

#define ast_rwlock_timedwrlock (   a,
  b 
)    __ast_rwlock_timedwrlock(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, #a, b)

Definition at line 238 of file lock.h.

◆ ast_rwlock_tryrdlock

#define ast_rwlock_tryrdlock (   a)    __ast_rwlock_tryrdlock(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, #a)

◆ ast_rwlock_trywrlock

#define ast_rwlock_trywrlock (   a)    __ast_rwlock_trywrlock(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, #a)

Definition at line 236 of file lock.h.

Referenced by cleanup_module(), dispatch_thread_handler(), and load_module().

◆ ast_rwlock_unlock

#define ast_rwlock_unlock (   a)    __ast_rwlock_unlock(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, #a)

Definition at line 232 of file lock.h.

Referenced by _ast_hashtab_insert_immediate(), _ast_hashtab_insert_safe(), action_messagesend(), add_codec2index(), add_static_payload(), allowed_on_shutdown(), ast_adsi_available(), ast_adsi_begin_download(), ast_adsi_channel_restore(), ast_adsi_clear_screen(), ast_adsi_clear_soft_keys(), ast_adsi_connect_session(), ast_adsi_data_mode(), ast_adsi_disconnect_session(), ast_adsi_display(), ast_adsi_download_connect(), ast_adsi_download_disconnect(), ast_adsi_end_download(), ast_adsi_get_cpeid(), ast_adsi_get_cpeinfo(), ast_adsi_input_control(), ast_adsi_input_format(), ast_adsi_install_funcs(), ast_adsi_load_session(), ast_adsi_load_soft_key(), ast_adsi_print(), ast_adsi_query_cpeid(), ast_adsi_query_cpeinfo(), ast_adsi_read_encoded_dtmf(), ast_adsi_set_keys(), ast_adsi_set_line(), ast_adsi_transmit_message(), ast_adsi_transmit_message_full(), ast_adsi_unload_session(), ast_adsi_voice_mode(), ast_calendar_config_acquire(), ast_calendar_config_release(), ast_cli_allow_at_shutdown(), ast_hashtab_destroy(), ast_hashtab_end_traversal(), ast_hashtab_get_stats(), ast_hashtab_lookup(), ast_hashtab_lookup_with_hash(), ast_hashtab_remove_object_via_lookup(), ast_hashtab_remove_this_object(), ast_hashtab_unlock(), ast_msg_handler_register(), ast_msg_handler_unregister(), ast_msg_has_destination(), ast_msg_send(), ast_msg_tech_register(), ast_msg_tech_unregister(), ast_rtp_codecs_find_payload_code(), ast_rtp_codecs_get_framing(), ast_rtp_codecs_get_payload(), ast_rtp_codecs_get_payload_format(), ast_rtp_codecs_get_stream_type(), ast_rtp_codecs_payload_code(), ast_rtp_codecs_payload_code_tx(), ast_rtp_codecs_payload_formats(), ast_rtp_codecs_payload_replace_format(), ast_rtp_codecs_payloads_copy(), ast_rtp_codecs_payloads_set_m_type(), ast_rtp_codecs_payloads_set_rtpmap_type_rate(), ast_rtp_codecs_payloads_unset(), ast_rtp_codecs_payloads_xover(), ast_rtp_codecs_set_framing(), ast_rtp_engine_unload_format(), ast_rtp_lookup_mime_subtype2(), ast_rtp_lookup_sample_rate2(), ast_str_retrieve_variable(), ast_taskprocessor_alert_get(), ast_unlock_context(), beanstalk_put(), cel_bs_put(), cleanup_module(), codec_to_index(), corosync_show_config(), corosync_show_members(), cpg_confchg_cb(), cpg_deliver_cb(), destroy_pvts(), destroy_table(), dispatch_thread_handler(), get_active_pvt(), get_general_options(), get_odbc_obj(), get_or_create_subscription(), get_subscription(), handle_msg_cb(), handle_show_globals(), has_destination_cb(), index2codec(), load_config(), load_general_config(), load_module(), load_tech_calendars(), manager_log(), matrix_resize(), messaging_app_unsubscribe_endpoint(), msg_q_cb(), msg_send_exec(), pbx_builtin_clear_globals(), pbx_builtin_getvar_helper(), pbx_builtin_pushvar_helper(), pbx_builtin_setvar_helper(), publish_event_to_corosync(), reload(), remove_shutdown_command(), rtp_codecs_assign_payload_code_rx(), rtp_engine_shutdown(), rtp_learning_start(), rtp_reload(), send_cluster_notify(), set_active(), set_general_options(), set_next_mime_type(), sip_outbound_publish_client_get_publisher(), tps_alert_add(), and translate_shutdown().

◆ ast_rwlock_wrlock

#define ast_rwlock_wrlock (   a)    __ast_rwlock_wrlock(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, #a)

◆ CHANNEL_DEADLOCK_AVOIDANCE

#define CHANNEL_DEADLOCK_AVOIDANCE (   chan)
Value:
usleep(1); \
ast_channel_lock(chan);
#define ast_channel_unlock(chan)
Definition: channel.h:2838

Definition at line 472 of file lock.h.

Referenced by ast_hangup(), dahdi_handle_event(), dahdi_read(), mbl_read(), and mbl_write().

◆ DEADLOCK_AVOIDANCE

#define DEADLOCK_AVOIDANCE (   lock)

◆ DLA_LOCK

#define DLA_LOCK (   lock)    ast_mutex_lock(lock)

Definition at line 490 of file lock.h.

Referenced by dahdi_handle_event().

◆ DLA_UNLOCK

#define DLA_UNLOCK (   lock)    ast_mutex_unlock(lock)

Definition at line 488 of file lock.h.

Referenced by dahdi_handle_event().

◆ gethostbyname

#define gethostbyname   __gethostbyname__is__not__reentrant__use__ast_gethostbyname__instead__

Definition at line 637 of file lock.h.

Referenced by connect_asterisk(), connect_sphinx(), connect_to_host(), main(), and manager_login().

◆ pthread_cond_broadcast

#define pthread_cond_broadcast   use_ast_cond_broadcast_instead_of_pthread_cond_broadcast

Definition at line 631 of file lock.h.

Referenced by __ast_cond_broadcast().

◆ pthread_cond_destroy

#define pthread_cond_destroy   use_ast_cond_destroy_instead_of_pthread_cond_destroy

Definition at line 629 of file lock.h.

Referenced by __ast_cond_destroy().

◆ pthread_cond_init

#define pthread_cond_init   use_ast_cond_init_instead_of_pthread_cond_init

Definition at line 628 of file lock.h.

Referenced by __ast_cond_init().

◆ pthread_cond_signal

#define pthread_cond_signal   use_ast_cond_signal_instead_of_pthread_cond_signal

Definition at line 630 of file lock.h.

Referenced by __ast_cond_signal().

◆ pthread_cond_t

#define pthread_cond_t   use_ast_cond_t_instead_of_pthread_cond_t

Definition at line 621 of file lock.h.

◆ pthread_cond_timedwait

#define pthread_cond_timedwait   use_ast_cond_timedwait_instead_of_pthread_cond_timedwait

Definition at line 633 of file lock.h.

Referenced by __ast_cond_timedwait().

◆ pthread_cond_wait

#define pthread_cond_wait   use_ast_cond_wait_instead_of_pthread_cond_wait

Definition at line 632 of file lock.h.

Referenced by __ast_cond_wait().

◆ pthread_create

#define pthread_create   __use_ast_pthread_create_instead__

Definition at line 640 of file lock.h.

Referenced by ast_pthread_create_stack(), main(), misdn_lib_init(), and misdn_tasks_init().

◆ pthread_mutex_destroy

#define pthread_mutex_destroy   use_ast_mutex_destroy_instead_of_pthread_mutex_destroy

Definition at line 627 of file lock.h.

Referenced by __ast_pthread_mutex_destroy(), ast_spinlock_destroy(), and stack_destroy().

◆ pthread_mutex_init

#define pthread_mutex_init   use_ast_mutex_init_instead_of_pthread_mutex_init

◆ PTHREAD_MUTEX_INIT_VALUE

#define PTHREAD_MUTEX_INIT_VALUE   PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP

Definition at line 76 of file lock.h.

◆ pthread_mutex_lock

#define pthread_mutex_lock   use_ast_mutex_lock_instead_of_pthread_mutex_lock

◆ pthread_mutex_t

#define pthread_mutex_t   use_ast_mutex_t_instead_of_pthread_mutex_t

◆ pthread_mutex_trylock

#define pthread_mutex_trylock   use_ast_mutex_trylock_instead_of_pthread_mutex_trylock

◆ pthread_mutex_unlock

#define pthread_mutex_unlock   use_ast_mutex_unlock_instead_of_pthread_mutex_unlock

◆ ROFFSET

#define ROFFSET   ((lt->reentrancy > 0) ? (lt->reentrancy-1) : 0)

◆ SCOPED_AO2LOCK

#define SCOPED_AO2LOCK (   varname,
  obj 
)    SCOPED_LOCK(varname, (obj), ao2_lock, ao2_unlock)

scoped lock specialization for ao2 mutexes.

Definition at line 602 of file lock.h.

Referenced by apply_menu_to_user(), ast_cdr_fork(), ast_endpoint_snapshot_create(), ast_media_cache_create_or_update(), ast_media_cache_retrieve(), ast_sip_publish_client_send(), ast_sip_session_register_sdp_handler(), ast_taskprocessor_set_local(), ast_threadpool_push(), ast_threadpool_set_size(), ast_unreal_channel_push_to_bridge(), cancel_and_unpublish(), clear_stimulus_queue(), cli_show_channels(), complete_confbridge_participant(), consumer_exec(), consumer_exec_sync(), consumer_should_stay(), consumer_wait_for(), consumer_wait_for_completion(), event_session_shutdown(), find_route(), generic_mute_unmute_helper(), get_wait_bridge_wrapper(), handle_bridge_enter(), handle_local_optimization_begin(), handle_local_optimization_end(), kick_conference_participant(), one_protocol(), persistent_endpoint_find_or_create(), playback_cancel(), playback_final_update(), playback_first_update(), playback_forward(), playback_pause(), playback_restart(), playback_reverse(), playback_stop(), playback_unpause(), publisher_client_send(), recording_set_state(), remove_stasis_subscriptions(), sip_outbound_publish_callback(), sip_publisher_service_queue(), stasis_app_control_record(), stasis_app_playback_get_state(), stasis_app_playback_operation(), stasis_app_recording_operation(), stasis_topic_pool_get_topic(), threadpool_active_thread_idle(), threadpool_idle_thread_dead(), threadpool_tps_emptied(), threadpool_tps_task_pushed(), and threadpool_zombie_thread_dead().

◆ SCOPED_AO2RDLOCK

#define SCOPED_AO2RDLOCK (   varname,
  obj 
)    SCOPED_LOCK(varname, (obj), ao2_rdlock, ao2_unlock)

scoped lock specialization for ao2 read locks.

Definition at line 607 of file lock.h.

Referenced by bucket_file_wizard_retrieve(), and bucket_wizard_retrieve().

◆ SCOPED_AO2WRLOCK

#define SCOPED_AO2WRLOCK (   varname,
  obj 
)    SCOPED_LOCK(varname, (obj), ao2_wrlock, ao2_unlock)

scoped lock specialization for ao2 write locks.

Definition at line 612 of file lock.h.

Referenced by __ast_bucket_scheme_register(), __ast_codec_register_with_format(), __ast_format_interface_register(), and ast_format_cache_set().

◆ SCOPED_CHANNELLOCK

#define SCOPED_CHANNELLOCK (   varname,
  chan 
)    SCOPED_LOCK(varname, (chan), ast_channel_lock, ast_channel_unlock)

◆ SCOPED_LOCK

#define SCOPED_LOCK (   varname,
  lock,
  lockfunc,
  unlockfunc 
)    RAII_VAR(typeof((lock)), varname, ({lockfunc((lock)); (lock); }), unlockfunc)

Scoped Locks.

Scoped locks provide a way to use RAII locks. In other words, declaration of a scoped lock will automatically define and lock the lock. When the lock goes out of scope, it will automatically be unlocked.

int some_function(struct ast_channel *chan)
{
if (!strcmp(ast_channel_name(chan, "foo")) {
return 0;
}
return -1;
}

In the above example, neither return path requires explicit unlocking of the channel.

Note
Care should be taken when using SCOPED_LOCKS in conjunction with ao2 objects. ao2 objects should be unlocked before they are unreffed. Since SCOPED_LOCK runs once the variable goes out of scope, this can easily lead to situations where the variable gets unlocked after it is unreffed.
Parameters
varnameThe unique name to give to the scoped lock. You are not likely to reference this outside of the SCOPED_LOCK invocation.
lockThe variable to lock. This can be anything that can be passed to a locking or unlocking function.
lockfuncThe function to call to lock the lock
unlockfuncThe function to call to unlock the lock

Definition at line 581 of file lock.h.

Referenced by add_headers_to_message(), ast_bridge_basic_set_flags(), ast_bridge_transfer_attended(), ast_bridge_transfer_blind(), ast_sip_format_endpoint_ami(), ast_sip_identify_endpoint(), ast_sip_register_endpoint_formatter(), ast_sip_register_endpoint_identifier_with_name(), ast_sip_register_event_publisher_handler(), ast_sip_register_supplement(), ast_sip_session_add_supplements(), ast_sip_session_register_supplement_with_module(), ast_sip_session_unregister_supplement(), ast_sip_unregister_endpoint_formatter(), ast_sip_unregister_endpoint_identifier(), ast_sip_unregister_event_publisher_handler(), ast_sip_unregister_supplement(), AST_TEST_DEFINE(), bridge_basic_change_personality(), channel_get_external_vars(), cli_show_endpoint_identifiers(), get_sip_pvt_from_replaces(), handle_request_invite(), and remove_hooks_on_personality_change().

◆ SCOPED_MUTEX

#define SCOPED_MUTEX (   varname,
  lock 
)    SCOPED_LOCK(varname, (lock), ast_mutex_lock, ast_mutex_unlock)

◆ SCOPED_RDLOCK

#define SCOPED_RDLOCK (   varname,
  lock 
)    SCOPED_LOCK(varname, (lock), ast_rwlock_rdlock, ast_rwlock_unlock)

scoped lock specialization for read locks

Definition at line 592 of file lock.h.

Referenced by ast_get_extension_for_mime_type(), ast_get_format_for_file_ext(), ast_start_mixmonitor(), and ast_stop_mixmonitor().

◆ SCOPED_WRLOCK

#define SCOPED_WRLOCK (   varname,
  lock 
)    SCOPED_LOCK(varname, (lock), ast_rwlock_wrlock, ast_rwlock_unlock)

scoped lock specialization for write locks

Definition at line 597 of file lock.h.

Referenced by ast_clear_mixmonitor_methods(), ast_set_mixmonitor_methods(), ast_sip_publish_client_remove(), and get_publishes_and_update_state().

Typedef Documentation

◆ ast_cond_t

Definition at line 176 of file lock.h.

◆ ast_mutex_t

typedef struct ast_mutex_info ast_mutex_t

Definition at line 172 of file lock.h.

◆ ast_rwlock_t

typedef struct ast_rwlock_info ast_rwlock_t

Definition at line 174 of file lock.h.

Function Documentation

◆ __ast_cond_broadcast()

int __ast_cond_broadcast ( const char *  filename,
int  lineno,
const char *  func,
const char *  cond_name,
ast_cond_t cond 
)

Definition at line 504 of file lock.c.

References pthread_cond_broadcast.

506 {
508 }
#define pthread_cond_broadcast
Definition: lock.h:631
ast_cond_t cond
Definition: app_meetme.c:1090

◆ __ast_cond_destroy()

int __ast_cond_destroy ( const char *  filename,
int  lineno,
const char *  func,
const char *  cond_name,
ast_cond_t cond 
)

◆ __ast_cond_init()

int __ast_cond_init ( const char *  filename,
int  lineno,
const char *  func,
const char *  cond_name,
ast_cond_t cond,
pthread_condattr_t *  cond_attr 
)

Definition at line 492 of file lock.c.

References pthread_cond_init.

494 {
495  return pthread_cond_init(cond, cond_attr);
496 }
#define pthread_cond_init
Definition: lock.h:628
ast_cond_t cond
Definition: app_meetme.c:1090

◆ __ast_cond_signal()

int __ast_cond_signal ( const char *  filename,
int  lineno,
const char *  func,
const char *  cond_name,
ast_cond_t cond 
)

Definition at line 498 of file lock.c.

References pthread_cond_signal.

500 {
501  return pthread_cond_signal(cond);
502 }
ast_cond_t cond
Definition: app_meetme.c:1090
#define pthread_cond_signal
Definition: lock.h:630

◆ __ast_cond_timedwait()

int __ast_cond_timedwait ( const char *  filename,
int  lineno,
const char *  func,
const char *  cond_name,
const char *  mutex_name,
ast_cond_t cond,
ast_mutex_t t,
const struct timespec *  abstime 
)

Definition at line 604 of file lock.c.

References ast_lock_track::backtrace, ast_lock_track::file, ast_lock_track::func, ast_lock_track::lineno, ast_mutex_info::mutex, NULL, pthread_cond_timedwait, pthread_mutex_t, ast_lock_track::reentrancy, ROFFSET, and ast_lock_track::thread_id.

607 {
608  int res;
609 
610 #ifdef DEBUG_THREADS
611  struct ast_lock_track *lt = NULL;
612  struct ast_lock_track lt_orig;
613  int canlog = t->flags.tracking && strcmp(filename, "logger.c");
614 
615 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
616  if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
617  log_mutex_error(canlog, "%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
618  filename, lineno, func, mutex_name);
619  DO_THREAD_CRASH;
620  return EINVAL;
621  }
622 #endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
623 
624  lt = ast_get_reentrancy(&t->track, &t->flags, 0);
625  if (lt) {
626  ast_reentrancy_lock(lt);
627  if (lt->reentrancy && (lt->thread_id[ROFFSET] != pthread_self())) {
628  log_mutex_error(canlog, "%s line %d (%s): attempted wait using mutex '%s' without owning it!\n",
629  filename, lineno, func, mutex_name);
630  log_mutex_error(canlog, "%s line %d (%s): '%s' was locked here.\n",
631  lt->file[ROFFSET], lt->lineno[ROFFSET], lt->func[ROFFSET], mutex_name);
632 #ifdef HAVE_BKTR
633  __dump_backtrace(&lt->backtrace[ROFFSET], canlog);
634 #endif
635  DO_THREAD_CRASH;
636  } else if (lt->reentrancy <= 0) {
637  log_mutex_error(canlog, "%s line %d (%s): attempted wait using an unlocked mutex '%s'\n",
638  filename, lineno, func, mutex_name);
639  DO_THREAD_CRASH;
640  }
641 
642  /* Waiting on a condition completely suspends a recursive mutex,
643  * even if it's been recursively locked multiple times. Make a
644  * copy of the lock tracking, and reset reentrancy to zero */
645  lt_orig = *lt;
646  lt->reentrancy = 0;
647  ast_reentrancy_unlock(lt);
648 
649  ast_suspend_lock_info(t);
650  }
651 #endif /* DEBUG_THREADS */
652 
653  res = pthread_cond_timedwait(cond, &t->mutex, abstime);
654 
655 #ifdef DEBUG_THREADS
656  if (res && (res != ETIMEDOUT)) {
657  log_mutex_error(canlog, "%s line %d (%s): Error waiting on condition mutex '%s'\n",
658  filename, lineno, func, strerror(res));
659  DO_THREAD_CRASH;
660  } else if (lt) {
661  restore_lock_tracking(lt, &lt_orig);
662  ast_restore_lock_info(t);
663  }
664 #endif /* DEBUG_THREADS */
665 
666  return res;
667 }
const char * file[AST_MAX_REENTRANCY]
Definition: lock.h:112
int reentrancy
Definition: lock.h:114
#define NULL
Definition: resample.c:96
int lineno[AST_MAX_REENTRANCY]
Definition: lock.h:113
#define pthread_mutex_t
Definition: lock.h:620
struct ast_bt backtrace[AST_MAX_REENTRANCY]
Definition: lock.h:118
Lock tracking information.
Definition: lock.h:111
ast_cond_t cond
Definition: app_meetme.c:1090
#define ROFFSET
Definition: lock.h:240
const char * func[AST_MAX_REENTRANCY]
Definition: lock.h:115
pthread_t thread_id[AST_MAX_REENTRANCY]
Definition: lock.h:116
pthread_mutex_t mutex
Definition: lock.h:136
#define pthread_cond_timedwait
Definition: lock.h:633

◆ __ast_cond_wait()

int __ast_cond_wait ( const char *  filename,
int  lineno,
const char *  func,
const char *  cond_name,
const char *  mutex_name,
ast_cond_t cond,
ast_mutex_t t 
)

Definition at line 539 of file lock.c.

References ast_lock_track::backtrace, ast_lock_track::file, ast_lock_track::func, ast_lock_track::lineno, ast_mutex_info::mutex, NULL, pthread_cond_wait, pthread_mutex_t, ast_lock_track::reentrancy, ROFFSET, and ast_lock_track::thread_id.

542 {
543  int res;
544 
545 #ifdef DEBUG_THREADS
546  struct ast_lock_track *lt = NULL;
547  struct ast_lock_track lt_orig;
548  int canlog = t->flags.tracking && strcmp(filename, "logger.c");
549 
550 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
551  if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
552  log_mutex_error(canlog, "%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
553  filename, lineno, func, mutex_name);
554  DO_THREAD_CRASH;
555  return EINVAL;
556  }
557 #endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
558 
559  lt = ast_get_reentrancy(&t->track, &t->flags, 0);
560  if (lt) {
561  ast_reentrancy_lock(lt);
562  if (lt->reentrancy && (lt->thread_id[ROFFSET] != pthread_self())) {
563  log_mutex_error(canlog, "%s line %d (%s): attempted wait using mutex '%s' without owning it!\n",
564  filename, lineno, func, mutex_name);
565  log_mutex_error(canlog, "%s line %d (%s): '%s' was locked here.\n",
566  lt->file[ROFFSET], lt->lineno[ROFFSET], lt->func[ROFFSET], mutex_name);
567 #ifdef HAVE_BKTR
568  __dump_backtrace(&lt->backtrace[ROFFSET], canlog);
569 #endif
570  DO_THREAD_CRASH;
571  } else if (lt->reentrancy <= 0) {
572  log_mutex_error(canlog, "%s line %d (%s): attempted wait using an unlocked mutex '%s'\n",
573  filename, lineno, func, mutex_name);
574  DO_THREAD_CRASH;
575  }
576 
577  /* Waiting on a condition completely suspends a recursive mutex,
578  * even if it's been recursively locked multiple times. Make a
579  * copy of the lock tracking, and reset reentrancy to zero */
580  lt_orig = *lt;
581  lt->reentrancy = 0;
582  ast_reentrancy_unlock(lt);
583 
584  ast_suspend_lock_info(t);
585  }
586 #endif /* DEBUG_THREADS */
587 
588  res = pthread_cond_wait(cond, &t->mutex);
589 
590 #ifdef DEBUG_THREADS
591  if (res) {
592  log_mutex_error(canlog, "%s line %d (%s): Error waiting on condition mutex '%s'\n",
593  filename, lineno, func, strerror(res));
594  DO_THREAD_CRASH;
595  } else if (lt) {
596  restore_lock_tracking(lt, &lt_orig);
597  ast_restore_lock_info(t);
598  }
599 #endif /* DEBUG_THREADS */
600 
601  return res;
602 }
const char * file[AST_MAX_REENTRANCY]
Definition: lock.h:112
int reentrancy
Definition: lock.h:114
#define NULL
Definition: resample.c:96
int lineno[AST_MAX_REENTRANCY]
Definition: lock.h:113
#define pthread_mutex_t
Definition: lock.h:620
struct ast_bt backtrace[AST_MAX_REENTRANCY]
Definition: lock.h:118
Lock tracking information.
Definition: lock.h:111
#define pthread_cond_wait
Definition: lock.h:632
ast_cond_t cond
Definition: app_meetme.c:1090
#define ROFFSET
Definition: lock.h:240
const char * func[AST_MAX_REENTRANCY]
Definition: lock.h:115
pthread_t thread_id[AST_MAX_REENTRANCY]
Definition: lock.h:116
pthread_mutex_t mutex
Definition: lock.h:136

◆ __ast_pthread_mutex_destroy()

int __ast_pthread_mutex_destroy ( const char *  filename,
int  lineno,
const char *  func,
const char *  mutex_name,
ast_mutex_t t 
)

Definition at line 175 of file lock.c.

References ast_lock_track::backtrace, ast_lock_track::file, ast_lock_track::func, ast_lock_track::lineno, ast_mutex_info::mutex, pthread_mutex_destroy, pthread_mutex_t, pthread_mutex_trylock, pthread_mutex_unlock, ast_lock_track::reentrancy, ROFFSET, and ast_lock_track::thread_id.

177 {
178  int res;
179 
180 #ifdef DEBUG_THREADS
181  struct ast_lock_track *lt = ast_get_reentrancy(&t->track, &t->flags, 1);
182  int canlog = t->flags.tracking && strcmp(filename, "logger.c");
183 
184 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
185  if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
186  /* Don't try to uninitialize an uninitialized mutex
187  * This may have no effect on linux
188  * but it always generates a core on *BSD when
189  * linked with libpthread.
190  * This is not an error condition if the mutex is created on the fly.
191  */
192  log_mutex_error(canlog, "%s line %d (%s): NOTICE: mutex '%s' is uninitialized.\n",
193  filename, lineno, func, mutex_name);
194  DO_THREAD_CRASH;
195  res = EINVAL;
196  goto lt_cleanup;
197  }
198 #endif
199 
200  res = pthread_mutex_trylock(&t->mutex);
201  switch (res) {
202  case 0:
204  break;
205  case EINVAL:
206  log_mutex_error(canlog, "%s line %d (%s): Error: attempt to destroy invalid mutex '%s'.\n",
207  filename, lineno, func, mutex_name);
208  break;
209  case EBUSY:
210  log_mutex_error(canlog, "%s line %d (%s): Error: attempt to destroy locked mutex '%s'.\n",
211  filename, lineno, func, mutex_name);
212  if (lt) {
213  ast_reentrancy_lock(lt);
214  log_mutex_error(canlog, "%s line %d (%s): Error: '%s' was locked here.\n",
215  lt->file[ROFFSET], lt->lineno[ROFFSET], lt->func[ROFFSET], mutex_name);
216 #ifdef HAVE_BKTR
217  __dump_backtrace(&lt->backtrace[ROFFSET], canlog);
218 #endif
219  ast_reentrancy_unlock(lt);
220  }
221  break;
222  }
223 #endif /* DEBUG_THREADS */
224 
225  res = pthread_mutex_destroy(&t->mutex);
226 
227 #ifdef DEBUG_THREADS
228  if (res) {
229  log_mutex_error(canlog, "%s line %d (%s): Error destroying mutex %s: %s\n",
230  filename, lineno, func, mutex_name, strerror(res));
231  }
232 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
233 lt_cleanup:
234 #endif
235  if (lt) {
236  ast_reentrancy_lock(lt);
237  lt->file[0] = filename;
238  lt->lineno[0] = lineno;
239  lt->func[0] = func;
240  lt->reentrancy = 0;
241  lt->thread_id[0] = 0;
242 #ifdef HAVE_BKTR
243  memset(&lt->backtrace[0], 0, sizeof(lt->backtrace[0]));
244 #endif
245  ast_reentrancy_unlock(lt);
246  delete_reentrancy_cs(&t->track);
247  }
248 #endif /* DEBUG_THREADS */
249 
250  return res;
251 }
const char * file[AST_MAX_REENTRANCY]
Definition: lock.h:112
int reentrancy
Definition: lock.h:114
int lineno[AST_MAX_REENTRANCY]
Definition: lock.h:113
#define pthread_mutex_t
Definition: lock.h:620
struct ast_bt backtrace[AST_MAX_REENTRANCY]
Definition: lock.h:118
#define pthread_mutex_destroy
Definition: lock.h:627
Lock tracking information.
Definition: lock.h:111
#define ROFFSET
Definition: lock.h:240
const char * func[AST_MAX_REENTRANCY]
Definition: lock.h:115
pthread_t thread_id[AST_MAX_REENTRANCY]
Definition: lock.h:116
pthread_mutex_t mutex
Definition: lock.h:136
#define pthread_mutex_unlock
Definition: lock.h:624
#define pthread_mutex_trylock
Definition: lock.h:625

◆ __ast_pthread_mutex_init()

int __ast_pthread_mutex_init ( int  tracking,
const char *  filename,
int  lineno,
const char *  func,
const char *  mutex_name,
ast_mutex_t t 
)

Definition at line 144 of file lock.c.

References AST_MUTEX_KIND, ast_mutex_info::mutex, NULL, pthread_mutex_init, and pthread_mutex_t.

146 {
147  int res;
148  pthread_mutexattr_t attr;
149 
150 #ifdef DEBUG_THREADS
151 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
152  if ((t->mutex) != ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
153  int canlog = tracking && strcmp(filename, "logger.c");
154 
155  log_mutex_error(canlog, "%s line %d (%s): NOTICE: mutex '%s' is already initialized.\n",
156  filename, lineno, func, mutex_name);
157  DO_THREAD_CRASH;
158  return EBUSY;
159  }
160 #endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
161 
162  t->track = NULL;
163  t->flags.tracking = tracking;
164  t->flags.setup = 0;
165 #endif /* DEBUG_THREADS */
166 
167  pthread_mutexattr_init(&attr);
168  pthread_mutexattr_settype(&attr, AST_MUTEX_KIND);
169  res = pthread_mutex_init(&t->mutex, &attr);
170  pthread_mutexattr_destroy(&attr);
171 
172  return res;
173 }
#define pthread_mutex_init
Definition: lock.h:626
#define NULL
Definition: resample.c:96
int lineno[AST_MAX_REENTRANCY]
Definition: lock.h:113
#define pthread_mutex_t
Definition: lock.h:620
const char * func[AST_MAX_REENTRANCY]
Definition: lock.h:115
pthread_mutex_t mutex
Definition: lock.h:136
#define AST_MUTEX_KIND
Definition: lock.h:77

◆ __ast_pthread_mutex_lock()

int __ast_pthread_mutex_lock ( const char *  filename,
int  lineno,
const char *  func,
const char *  mutex_name,
ast_mutex_t t 
)

Definition at line 253 of file lock.c.

References ast_bt_get_addresses, ast_mark(), AST_MAX_REENTRANCY, AST_MUTEX, ast_lock_track::backtrace, ast_lock_track::file, ast_lock_track::func, ast_lock_track::lineno, ast_mutex_info::mutex, NULL, pthread_mutex_lock, pthread_mutex_trylock, ast_lock_track::reentrancy, ROFFSET, ast_lock_track::thread_id, and tmp().

Referenced by __ao2_lock().

255 {
256  int res;
257 
258 #ifdef DEBUG_THREADS
259  struct ast_lock_track *lt = ast_get_reentrancy(&t->track, &t->flags, 0);
260  int canlog = t->flags.tracking && strcmp(filename, "logger.c");
261  struct ast_bt *bt = NULL;
262 
263  if (lt) {
264 #ifdef HAVE_BKTR
265  struct ast_bt tmp;
266 
267  /* The implementation of backtrace() may have its own locks.
268  * Capture the backtrace outside of the reentrancy lock to
269  * avoid deadlocks. See ASTERISK-22455. */
271 
272  ast_reentrancy_lock(lt);
273  if (lt->reentrancy < AST_MAX_REENTRANCY) {
274  lt->backtrace[lt->reentrancy] = tmp;
275  bt = &lt->backtrace[lt->reentrancy];
276  }
277  ast_reentrancy_unlock(lt);
278 #endif
279  ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t, bt);
280  }
281 #endif /* DEBUG_THREADS */
282 
283 #if defined(DETECT_DEADLOCKS) && defined(DEBUG_THREADS)
284  {
285  time_t seconds = time(NULL);
286  time_t wait_time, reported_wait = 0;
287  do {
288 #ifdef HAVE_MTX_PROFILE
289  ast_mark(mtx_prof, 1);
290 #endif
291  res = pthread_mutex_trylock(&t->mutex);
292 #ifdef HAVE_MTX_PROFILE
293  ast_mark(mtx_prof, 0);
294 #endif
295  if (res == EBUSY) {
296  wait_time = time(NULL) - seconds;
297  if (wait_time > reported_wait && (wait_time % 5) == 0) {
298  log_mutex_error(canlog, "%s line %d (%s): Deadlock? waited %d sec for mutex '%s'?\n",
299  filename, lineno, func, (int) wait_time, mutex_name);
300  if (lt) {
301  ast_reentrancy_lock(lt);
302 #ifdef HAVE_BKTR
303  __dump_backtrace(&lt->backtrace[lt->reentrancy], canlog);
304 #endif
305  log_mutex_error(canlog, "%s line %d (%s): '%s' was locked here.\n",
306  lt->file[ROFFSET], lt->lineno[ROFFSET],
307  lt->func[ROFFSET], mutex_name);
308 #ifdef HAVE_BKTR
309  __dump_backtrace(&lt->backtrace[ROFFSET], canlog);
310 #endif
311  ast_reentrancy_unlock(lt);
312  }
313  reported_wait = wait_time;
314  }
315  usleep(200);
316  }
317  } while (res == EBUSY);
318  }
319 #else /* !DETECT_DEADLOCKS || !DEBUG_THREADS */
320 #ifdef HAVE_MTX_PROFILE
321  ast_mark(mtx_prof, 1);
322  res = pthread_mutex_trylock(&t->mutex);
323  ast_mark(mtx_prof, 0);
324  if (res)
325 #endif
326  res = pthread_mutex_lock(&t->mutex);
327 #endif /* !DETECT_DEADLOCKS || !DEBUG_THREADS */
328 
329 #ifdef DEBUG_THREADS
330  if (lt && !res) {
331  ast_reentrancy_lock(lt);
332  if (lt->reentrancy < AST_MAX_REENTRANCY) {
333  lt->file[lt->reentrancy] = filename;
334  lt->lineno[lt->reentrancy] = lineno;
335  lt->func[lt->reentrancy] = func;
336  lt->thread_id[lt->reentrancy] = pthread_self();
337  lt->reentrancy++;
338  } else {
339  log_mutex_error(canlog, "%s line %d (%s): '%s' really deep reentrancy!\n",
340  filename, lineno, func, mutex_name);
341  }
342  ast_reentrancy_unlock(lt);
343  ast_mark_lock_acquired(t);
344  } else if (lt) {
345 #ifdef HAVE_BKTR
346  if (lt->reentrancy) {
347  ast_reentrancy_lock(lt);
348  bt = &lt->backtrace[lt->reentrancy-1];
349  ast_reentrancy_unlock(lt);
350  } else {
351  bt = NULL;
352  }
353 #endif
354  ast_remove_lock_info(t, bt);
355  }
356  if (res) {
357  log_mutex_error(canlog, "%s line %d (%s): Error obtaining mutex: %s\n",
358  filename, lineno, func, strerror(res));
359  DO_THREAD_CRASH;
360  }
361 #endif /* DEBUG_THREADS */
362 
363  return res;
364 }
int64_t ast_mark(int, int start1_stop0)
Definition: astman.c:103
const char * file[AST_MAX_REENTRANCY]
Definition: lock.h:112
static int tmp()
Definition: bt_open.c:389
int reentrancy
Definition: lock.h:114
#define NULL
Definition: resample.c:96
int lineno[AST_MAX_REENTRANCY]
Definition: lock.h:113
struct ast_bt backtrace[AST_MAX_REENTRANCY]
Definition: lock.h:118
Lock tracking information.
Definition: lock.h:111
#define pthread_mutex_lock
Definition: lock.h:623
#define ROFFSET
Definition: lock.h:240
const char * func[AST_MAX_REENTRANCY]
Definition: lock.h:115
#define AST_MAX_REENTRANCY
Definition: lock.h:101
pthread_t thread_id[AST_MAX_REENTRANCY]
Definition: lock.h:116
pthread_mutex_t mutex
Definition: lock.h:136
#define pthread_mutex_trylock
Definition: lock.h:625
#define ast_bt_get_addresses(bt)
Definition: backtrace.h:38

◆ __ast_pthread_mutex_trylock()

int __ast_pthread_mutex_trylock ( const char *  filename,
int  lineno,
const char *  func,
const char *  mutex_name,
ast_mutex_t t 
)

Definition at line 366 of file lock.c.

References ast_bt_get_addresses, ast_mark_lock_failed(), AST_MAX_REENTRANCY, AST_MUTEX, ast_lock_track::backtrace, ast_lock_track::file, ast_lock_track::func, ast_lock_track::lineno, ast_mutex_info::mutex, NULL, pthread_mutex_trylock, ast_lock_track::reentrancy, ast_lock_track::thread_id, and tmp().

Referenced by __ao2_trylock().

368 {
369  int res;
370 
371 #ifdef DEBUG_THREADS
372  struct ast_lock_track *lt = ast_get_reentrancy(&t->track, &t->flags, 0);
373  int canlog = t->flags.tracking && strcmp(filename, "logger.c");
374  struct ast_bt *bt = NULL;
375 
376  if (lt) {
377 #ifdef HAVE_BKTR
378  struct ast_bt tmp;
379 
380  /* The implementation of backtrace() may have its own locks.
381  * Capture the backtrace outside of the reentrancy lock to
382  * avoid deadlocks. See ASTERISK-22455. */
384 
385  ast_reentrancy_lock(lt);
386  if (lt->reentrancy < AST_MAX_REENTRANCY) {
387  lt->backtrace[lt->reentrancy] = tmp;
388  bt = &lt->backtrace[lt->reentrancy];
389  }
390  ast_reentrancy_unlock(lt);
391 #endif
392  ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, t, bt);
393  }
394 #endif /* DEBUG_THREADS */
395 
396  res = pthread_mutex_trylock(&t->mutex);
397 
398 #ifdef DEBUG_THREADS
399  if (lt && !res) {
400  ast_reentrancy_lock(lt);
401  if (lt->reentrancy < AST_MAX_REENTRANCY) {
402  lt->file[lt->reentrancy] = filename;
403  lt->lineno[lt->reentrancy] = lineno;
404  lt->func[lt->reentrancy] = func;
405  lt->thread_id[lt->reentrancy] = pthread_self();
406  lt->reentrancy++;
407  } else {
408  log_mutex_error(canlog, "%s line %d (%s): '%s' really deep reentrancy!\n",
409  filename, lineno, func, mutex_name);
410  }
411  ast_reentrancy_unlock(lt);
412  ast_mark_lock_acquired(t);
413  } else if (lt) {
415  }
416 #endif /* DEBUG_THREADS */
417 
418  return res;
419 }
const char * file[AST_MAX_REENTRANCY]
Definition: lock.h:112
static int tmp()
Definition: bt_open.c:389
int reentrancy
Definition: lock.h:114
#define NULL
Definition: resample.c:96
int lineno[AST_MAX_REENTRANCY]
Definition: lock.h:113
struct ast_bt backtrace[AST_MAX_REENTRANCY]
Definition: lock.h:118
Lock tracking information.
Definition: lock.h:111
const char * func[AST_MAX_REENTRANCY]
Definition: lock.h:115
#define AST_MAX_REENTRANCY
Definition: lock.h:101
pthread_t thread_id[AST_MAX_REENTRANCY]
Definition: lock.h:116
pthread_mutex_t mutex
Definition: lock.h:136
void ast_mark_lock_failed(void *lock_addr)
Definition: extconf.c:2314
#define pthread_mutex_trylock
Definition: lock.h:625
#define ast_bt_get_addresses(bt)
Definition: backtrace.h:38

◆ __ast_pthread_mutex_unlock()

int __ast_pthread_mutex_unlock ( const char *  filename,
int  lineno,
const char *  func,
const char *  mutex_name,
ast_mutex_t t 
)

Definition at line 421 of file lock.c.

References AST_MAX_REENTRANCY, ast_lock_track::backtrace, ast_lock_track::file, ast_lock_track::func, ast_lock_track::lineno, ast_mutex_info::mutex, NULL, pthread_mutex_t, pthread_mutex_unlock, ast_lock_track::reentrancy, ROFFSET, and ast_lock_track::thread_id.

Referenced by __ao2_unlock().

423 {
424  int res;
425 
426 #ifdef DEBUG_THREADS
427  struct ast_lock_track *lt = NULL;
428  int canlog = t->flags.tracking && strcmp(filename, "logger.c");
429  struct ast_bt *bt = NULL;
430 
431 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
432  if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
433  log_mutex_error(canlog, "%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
434  filename, lineno, func, mutex_name);
435  DO_THREAD_CRASH;
436  return EINVAL;
437  }
438 #endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
439 
440  lt = ast_get_reentrancy(&t->track, &t->flags, 0);
441  if (lt) {
442  ast_reentrancy_lock(lt);
443  if (lt->reentrancy && (lt->thread_id[ROFFSET] != pthread_self())) {
444  log_mutex_error(canlog, "%s line %d (%s): attempted unlock mutex '%s' without owning it!\n",
445  filename, lineno, func, mutex_name);
446  log_mutex_error(canlog, "%s line %d (%s): '%s' was locked here.\n",
447  lt->file[ROFFSET], lt->lineno[ROFFSET], lt->func[ROFFSET], mutex_name);
448 #ifdef HAVE_BKTR
449  __dump_backtrace(&lt->backtrace[ROFFSET], canlog);
450 #endif
451  DO_THREAD_CRASH;
452  }
453 
454  if (--lt->reentrancy < 0) {
455  log_mutex_error(canlog, "%s line %d (%s): mutex '%s' freed more times than we've locked!\n",
456  filename, lineno, func, mutex_name);
457  lt->reentrancy = 0;
458  }
459 
460  if (lt->reentrancy < AST_MAX_REENTRANCY) {
461  lt->file[lt->reentrancy] = NULL;
462  lt->lineno[lt->reentrancy] = 0;
463  lt->func[lt->reentrancy] = NULL;
464  lt->thread_id[lt->reentrancy] = 0;
465  }
466 
467 #ifdef HAVE_BKTR
468  if (lt->reentrancy) {
469  bt = &lt->backtrace[lt->reentrancy - 1];
470  }
471 #endif
472  ast_reentrancy_unlock(lt);
473 
474  ast_remove_lock_info(t, bt);
475  }
476 #endif /* DEBUG_THREADS */
477 
478  res = pthread_mutex_unlock(&t->mutex);
479 
480 #ifdef DEBUG_THREADS
481  if (res) {
482  log_mutex_error(canlog, "%s line %d (%s): Error releasing mutex: %s\n",
483  filename, lineno, func, strerror(res));
484  DO_THREAD_CRASH;
485  }
486 #endif /* DEBUG_THREADS */
487 
488  return res;
489 }
const char * file[AST_MAX_REENTRANCY]
Definition: lock.h:112
int reentrancy
Definition: lock.h:114
#define NULL
Definition: resample.c:96
int lineno[AST_MAX_REENTRANCY]
Definition: lock.h:113
#define pthread_mutex_t
Definition: lock.h:620
struct ast_bt backtrace[AST_MAX_REENTRANCY]
Definition: lock.h:118
Lock tracking information.
Definition: lock.h:111
#define ROFFSET
Definition: lock.h:240
const char * func[AST_MAX_REENTRANCY]
Definition: lock.h:115
#define AST_MAX_REENTRANCY
Definition: lock.h:101
pthread_t thread_id[AST_MAX_REENTRANCY]
Definition: lock.h:116
pthread_mutex_t mutex
Definition: lock.h:136
#define pthread_mutex_unlock
Definition: lock.h:624

◆ __ast_rwlock_destroy()

int __ast_rwlock_destroy ( const char *  filename,
int  lineno,
const char *  func,
const char *  rwlock_name,
ast_rwlock_t t 
)

Definition at line 701 of file lock.c.

References __AST_RWLOCK_INIT_VALUE, ast_lock_track::backtrace, ast_lock_track::file, ast_lock_track::func, ast_lock_track::lineno, ast_rwlock_info::lock, ast_lock_track::reentrancy, and ast_lock_track::thread_id.

702 {
703  int res;
704 
705 #ifdef DEBUG_THREADS
706  struct ast_lock_track *lt = ast_get_reentrancy(&t->track, &t->flags, 1);
707  int canlog = t->flags.tracking && strcmp(filename, "logger.c");
708 
709 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
710  if (t->lock == ((pthread_rwlock_t) __AST_RWLOCK_INIT_VALUE)) {
711  log_mutex_error(canlog, "%s line %d (%s): Warning: rwlock '%s' is uninitialized.\n",
712  filename, lineno, func, rwlock_name);
713  DO_THREAD_CRASH;
714  res = EINVAL;
715  goto lt_cleanup;
716  }
717 #endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
718 #endif /* DEBUG_THREADS */
719 
720  res = pthread_rwlock_destroy(&t->lock);
721 
722 #ifdef DEBUG_THREADS
723  if (res) {
724  log_mutex_error(canlog, "%s line %d (%s): Error destroying rwlock %s: %s\n",
725  filename, lineno, func, rwlock_name, strerror(res));
726  }
727 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
728 lt_cleanup:
729 #endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
730  if (lt) {
731  ast_reentrancy_lock(lt);
732  lt->file[0] = filename;
733  lt->lineno[0] = lineno;
734  lt->func[0] = func;
735  lt->reentrancy = 0;
736  lt->thread_id[0] = 0;
737 #ifdef HAVE_BKTR
738  memset(&lt->backtrace[0], 0, sizeof(lt->backtrace[0]));
739 #endif
740  ast_reentrancy_unlock(lt);
741  delete_reentrancy_cs(&t->track);
742  }
743 #endif /* DEBUG_THREADS */
744 
745  return res;
746 }
const char * file[AST_MAX_REENTRANCY]
Definition: lock.h:112
#define __AST_RWLOCK_INIT_VALUE
Definition: lock.h:84
int reentrancy
Definition: lock.h:114
int lineno[AST_MAX_REENTRANCY]
Definition: lock.h:113
struct ast_bt backtrace[AST_MAX_REENTRANCY]
Definition: lock.h:118
Lock tracking information.
Definition: lock.h:111
const char * func[AST_MAX_REENTRANCY]
Definition: lock.h:115
pthread_t thread_id[AST_MAX_REENTRANCY]
Definition: lock.h:116
pthread_rwlock_t lock
Definition: lock.h:157

◆ __ast_rwlock_init()

int __ast_rwlock_init ( int  tracking,
const char *  filename,
int  lineno,
const char *  func,
const char *  rwlock_name,
ast_rwlock_t t 
)

Definition at line 669 of file lock.c.

References __AST_RWLOCK_INIT_VALUE, ast_rwlock_info::lock, and NULL.

670 {
671  int res;
672  pthread_rwlockattr_t attr;
673 
674 #ifdef DEBUG_THREADS
675 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
676  if (t->lock != ((pthread_rwlock_t) __AST_RWLOCK_INIT_VALUE)) {
677  int canlog = tracking && strcmp(filename, "logger.c");
678 
679  log_mutex_error(canlog, "%s line %d (%s): Warning: rwlock '%s' is already initialized.\n",
680  filename, lineno, func, rwlock_name);
681  DO_THREAD_CRASH;
682  return EBUSY;
683  }
684 #endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
685 
686  t->track = NULL;
687  t->flags.tracking = tracking;
688  t->flags.setup = 0;
689 #endif /* DEBUG_THREADS */
690 
691  pthread_rwlockattr_init(&attr);
692 #ifdef HAVE_PTHREAD_RWLOCK_PREFER_WRITER_NP
693  pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NP);
694 #endif
695  res = pthread_rwlock_init(&t->lock, &attr);
696  pthread_rwlockattr_destroy(&attr);
697 
698  return res;
699 }
#define __AST_RWLOCK_INIT_VALUE
Definition: lock.h:84
#define NULL
Definition: resample.c:96
int lineno[AST_MAX_REENTRANCY]
Definition: lock.h:113
const char * func[AST_MAX_REENTRANCY]
Definition: lock.h:115
pthread_rwlock_t lock
Definition: lock.h:157

◆ __ast_rwlock_rdlock()

int __ast_rwlock_rdlock ( const char *  filename,
int  lineno,
const char *  func,
ast_rwlock_t t,
const char *  name 
)

Definition at line 819 of file lock.c.

References ast_bt_get_addresses, AST_MAX_REENTRANCY, AST_RDLOCK, ast_lock_track::backtrace, ast_lock_track::file, ast_lock_track::func, ast_lock_track::lineno, ast_rwlock_info::lock, NULL, ast_lock_track::reentrancy, ast_lock_track::thread_id, and tmp().

Referenced by __ao2_global_obj_ref(), __ao2_lock(), and __ast_heap_rdlock().

820 {
821  int res;
822 
823 #ifdef DEBUG_THREADS
824  struct ast_lock_track *lt = ast_get_reentrancy(&t->track, &t->flags, 0);
825  int canlog = t->flags.tracking && strcmp(filename, "logger.c");
826  struct ast_bt *bt = NULL;
827 
828  if (lt) {
829 #ifdef HAVE_BKTR
830  struct ast_bt tmp;
831 
832  /* The implementation of backtrace() may have its own locks.
833  * Capture the backtrace outside of the reentrancy lock to
834  * avoid deadlocks. See ASTERISK-22455. */
836 
837  ast_reentrancy_lock(lt);
838  if (lt->reentrancy < AST_MAX_REENTRANCY) {
839  lt->backtrace[lt->reentrancy] = tmp;
840  bt = &lt->backtrace[lt->reentrancy];
841  }
842  ast_reentrancy_unlock(lt);
843 #endif
844  ast_store_lock_info(AST_RDLOCK, filename, line, func, name, t, bt);
845  }
846 #endif /* DEBUG_THREADS */
847 
848 #if defined(DETECT_DEADLOCKS) && defined(DEBUG_THREADS)
849  {
850  time_t seconds = time(NULL);
851  time_t wait_time, reported_wait = 0;
852  do {
853  res = pthread_rwlock_tryrdlock(&t->lock);
854  if (res == EBUSY) {
855  wait_time = time(NULL) - seconds;
856  if (wait_time > reported_wait && (wait_time % 5) == 0) {
857  log_mutex_error(canlog, "%s line %d (%s): Deadlock? waited %d sec for readlock '%s'?\n",
858  filename, line, func, (int)wait_time, name);
859  if (lt) {
860  ast_reentrancy_lock(lt);
861 #ifdef HAVE_BKTR
862  __dump_backtrace(&lt->backtrace[lt->reentrancy], canlog);
863 #endif
864  log_mutex_error(canlog, "%s line %d (%s): '%s' was locked here.\n",
865  lt->file[lt->reentrancy-1], lt->lineno[lt->reentrancy-1],
866  lt->func[lt->reentrancy-1], name);
867 #ifdef HAVE_BKTR
868  __dump_backtrace(&lt->backtrace[lt->reentrancy-1], canlog);
869 #endif
870  ast_reentrancy_unlock(lt);
871  }
872  reported_wait = wait_time;
873  }
874  usleep(200);
875  }
876  } while (res == EBUSY);
877  }
878 #else /* !DETECT_DEADLOCKS || !DEBUG_THREADS */
879  res = pthread_rwlock_rdlock(&t->lock);
880 #endif /* !DETECT_DEADLOCKS || !DEBUG_THREADS */
881 
882 #ifdef DEBUG_THREADS
883  if (!res && lt) {
884  ast_reentrancy_lock(lt);
885  if (lt->reentrancy < AST_MAX_REENTRANCY) {
886  lt->file[lt->reentrancy] = filename;
887  lt->lineno[lt->reentrancy] = line;
888  lt->func[lt->reentrancy] = func;
889  lt->thread_id[lt->reentrancy] = pthread_self();
890  lt->reentrancy++;
891  }
892  ast_reentrancy_unlock(lt);
893  ast_mark_lock_acquired(t);
894  } else if (lt) {
895 #ifdef HAVE_BKTR
896  if (lt->reentrancy) {
897  ast_reentrancy_lock(lt);
898  bt = &lt->backtrace[lt->reentrancy-1];
899  ast_reentrancy_unlock(lt);
900  } else {
901  bt = NULL;
902  }
903 #endif
904  ast_remove_lock_info(t, bt);
905  }
906 
907  if (res) {
908  log_mutex_error(canlog, "%s line %d (%s): Error obtaining read lock: %s\n",
909  filename, line, func, strerror(res));
910  DO_THREAD_CRASH;
911  }
912 #endif /* DEBUG_THREADS */
913 
914  return res;
915 }
const char * file[AST_MAX_REENTRANCY]
Definition: lock.h:112
static int tmp()
Definition: bt_open.c:389
int reentrancy
Definition: lock.h:114
#define NULL
Definition: resample.c:96
int lineno[AST_MAX_REENTRANCY]
Definition: lock.h:113
struct ast_bt backtrace[AST_MAX_REENTRANCY]
Definition: lock.h:118
Lock tracking information.
Definition: lock.h:111
const char * func[AST_MAX_REENTRANCY]
Definition: lock.h:115
static const char name[]
Definition: cdr_mysql.c:74
#define AST_MAX_REENTRANCY
Definition: lock.h:101
pthread_t thread_id[AST_MAX_REENTRANCY]
Definition: lock.h:116
pthread_rwlock_t lock
Definition: lock.h:157
#define ast_bt_get_addresses(bt)
Definition: backtrace.h:38

◆ __ast_rwlock_timedrdlock()

int __ast_rwlock_timedrdlock ( const char *  filename,
int  lineno,
const char *  func,
ast_rwlock_t t,
const char *  name,
const struct timespec *  abs_timeout 
)

Definition at line 1014 of file lock.c.

References ast_bt_get_addresses, AST_MAX_REENTRANCY, ast_tvnow(), AST_WRLOCK, ast_lock_track::backtrace, ast_lock_track::file, ast_lock_track::func, ast_lock_track::lineno, ast_rwlock_info::lock, NULL, ast_lock_track::reentrancy, ast_lock_track::thread_id, and tmp().

1016 {
1017  int res;
1018 
1019 #ifdef DEBUG_THREADS
1020  struct ast_lock_track *lt = ast_get_reentrancy(&t->track, &t->flags, 0);
1021  int canlog = t->flags.tracking && strcmp(filename, "logger.c");
1022  struct ast_bt *bt = NULL;
1023 
1024  if (lt) {
1025 #ifdef HAVE_BKTR
1026  struct ast_bt tmp;
1027 
1028  /* The implementation of backtrace() may have its own locks.
1029  * Capture the backtrace outside of the reentrancy lock to
1030  * avoid deadlocks. See ASTERISK-22455. */
1032 
1033  ast_reentrancy_lock(lt);
1034  if (lt->reentrancy < AST_MAX_REENTRANCY) {
1035  lt->backtrace[lt->reentrancy] = tmp;
1036  bt = &lt->backtrace[lt->reentrancy];
1037  }
1038  ast_reentrancy_unlock(lt);
1039 #endif
1040  ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt);
1041  }
1042 #endif /* DEBUG_THREADS */
1043 
1044 #ifdef HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK
1045  res = pthread_rwlock_timedrdlock(&t->lock, abs_timeout);
1046 #else
1047  do {
1048  struct timeval _now;
1049  for (;;) {
1050  if (!(res = pthread_rwlock_tryrdlock(&t->lock))) {
1051  break;
1052  }
1053  _now = ast_tvnow();
1054  if (_now.tv_sec > abs_timeout->tv_sec || (_now.tv_sec == abs_timeout->tv_sec && _now.tv_usec * 1000 > abs_timeout->tv_nsec)) {
1055  break;
1056  }
1057  usleep(1);
1058  }
1059  } while (0);
1060 #endif
1061 
1062 #ifdef DEBUG_THREADS
1063  if (!res && lt) {
1064  ast_reentrancy_lock(lt);
1065  if (lt->reentrancy < AST_MAX_REENTRANCY) {
1066  lt->file[lt->reentrancy] = filename;
1067  lt->lineno[lt->reentrancy] = line;
1068  lt->func[lt->reentrancy] = func;
1069  lt->thread_id[lt->reentrancy] = pthread_self();
1070  lt->reentrancy++;
1071  }
1072  ast_reentrancy_unlock(lt);
1073  ast_mark_lock_acquired(t);
1074  } else if (lt) {
1075 #ifdef HAVE_BKTR
1076  if (lt->reentrancy) {
1077  ast_reentrancy_lock(lt);
1078  bt = &lt->backtrace[lt->reentrancy-1];
1079  ast_reentrancy_unlock(lt);
1080  } else {
1081  bt = NULL;
1082  }
1083 #endif
1084  ast_remove_lock_info(t, bt);
1085  }
1086  if (res) {
1087  log_mutex_error(canlog, "%s line %d (%s): Error obtaining read lock: %s\n",
1088  filename, line, func, strerror(res));
1089  DO_THREAD_CRASH;
1090  }
1091 #endif /* DEBUG_THREADS */
1092 
1093  return res;
1094 }
const char * file[AST_MAX_REENTRANCY]
Definition: lock.h:112
static int tmp()
Definition: bt_open.c:389
int reentrancy
Definition: lock.h:114
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Definition: time.h:150
#define NULL
Definition: resample.c:96
int lineno[AST_MAX_REENTRANCY]
Definition: lock.h:113
struct ast_bt backtrace[AST_MAX_REENTRANCY]
Definition: lock.h:118
Lock tracking information.
Definition: lock.h:111
const char * func[AST_MAX_REENTRANCY]
Definition: lock.h:115
static const char name[]
Definition: cdr_mysql.c:74
#define AST_MAX_REENTRANCY
Definition: lock.h:101
pthread_t thread_id[AST_MAX_REENTRANCY]
Definition: lock.h:116
pthread_rwlock_t lock
Definition: lock.h:157
#define ast_bt_get_addresses(bt)
Definition: backtrace.h:38

◆ __ast_rwlock_timedwrlock()

int __ast_rwlock_timedwrlock ( const char *  filename,
int  lineno,
const char *  func,
ast_rwlock_t t,
const char *  name,
const struct timespec *  abs_timeout 
)

Definition at line 1096 of file lock.c.

References ast_bt_get_addresses, AST_MAX_REENTRANCY, ast_tvnow(), AST_WRLOCK, ast_lock_track::backtrace, ast_lock_track::file, ast_lock_track::func, ast_lock_track::lineno, ast_rwlock_info::lock, NULL, ast_lock_track::reentrancy, ast_lock_track::thread_id, and tmp().

1098 {
1099  int res;
1100 
1101 #ifdef DEBUG_THREADS
1102  struct ast_lock_track *lt = ast_get_reentrancy(&t->track, &t->flags, 0);
1103  int canlog = t->flags.tracking && strcmp(filename, "logger.c");
1104  struct ast_bt *bt = NULL;
1105 
1106  if (lt) {
1107 #ifdef HAVE_BKTR
1108  struct ast_bt tmp;
1109 
1110  /* The implementation of backtrace() may have its own locks.
1111  * Capture the backtrace outside of the reentrancy lock to
1112  * avoid deadlocks. See ASTERISK-22455. */
1114 
1115  ast_reentrancy_lock(lt);
1116  if (lt->reentrancy < AST_MAX_REENTRANCY) {
1117  lt->backtrace[lt->reentrancy] = tmp;
1118  bt = &lt->backtrace[lt->reentrancy];
1119  }
1120  ast_reentrancy_unlock(lt);
1121 #endif
1122  ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt);
1123  }
1124 #endif /* DEBUG_THREADS */
1125 
1126 #ifdef HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK
1127  res = pthread_rwlock_timedwrlock(&t->lock, abs_timeout);
1128 #else
1129  do {
1130  struct timeval _now;
1131  for (;;) {
1132  if (!(res = pthread_rwlock_trywrlock(&t->lock))) {
1133  break;
1134  }
1135  _now = ast_tvnow();
1136  if (_now.tv_sec > abs_timeout->tv_sec || (_now.tv_sec == abs_timeout->tv_sec && _now.tv_usec * 1000 > abs_timeout->tv_nsec)) {
1137  break;
1138  }
1139  usleep(1);
1140  }
1141  } while (0);
1142 #endif
1143 
1144 #ifdef DEBUG_THREADS
1145  if (!res && lt) {
1146  ast_reentrancy_lock(lt);
1147  if (lt->reentrancy < AST_MAX_REENTRANCY) {
1148  lt->file[lt->reentrancy] = filename;
1149  lt->lineno[lt->reentrancy] = line;
1150  lt->func[lt->reentrancy] = func;
1151  lt->thread_id[lt->reentrancy] = pthread_self();
1152  lt->reentrancy++;
1153  }
1154  ast_reentrancy_unlock(lt);
1155  ast_mark_lock_acquired(t);
1156  } else if (lt) {
1157 #ifdef HAVE_BKTR
1158  if (lt->reentrancy) {
1159  ast_reentrancy_lock(lt);
1160  bt = &lt->backtrace[lt->reentrancy-1];
1161  ast_reentrancy_unlock(lt);
1162  } else {
1163  bt = NULL;
1164  }
1165 #endif
1166  ast_remove_lock_info(t, bt);
1167  }
1168  if (res) {
1169  log_mutex_error(canlog, "%s line %d (%s): Error obtaining read lock: %s\n",
1170  filename, line, func, strerror(res));
1171  DO_THREAD_CRASH;
1172  }
1173 #endif /* DEBUG_THREADS */
1174 
1175  return res;
1176 }
const char * file[AST_MAX_REENTRANCY]
Definition: lock.h:112
static int tmp()
Definition: bt_open.c:389
int reentrancy
Definition: lock.h:114
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Definition: time.h:150
#define NULL
Definition: resample.c:96
int lineno[AST_MAX_REENTRANCY]
Definition: lock.h:113
struct ast_bt backtrace[AST_MAX_REENTRANCY]
Definition: lock.h:118
Lock tracking information.
Definition: lock.h:111
const char * func[AST_MAX_REENTRANCY]
Definition: lock.h:115
static const char name[]
Definition: cdr_mysql.c:74
#define AST_MAX_REENTRANCY
Definition: lock.h:101
pthread_t thread_id[AST_MAX_REENTRANCY]
Definition: lock.h:116
pthread_rwlock_t lock
Definition: lock.h:157
#define ast_bt_get_addresses(bt)
Definition: backtrace.h:38

◆ __ast_rwlock_tryrdlock()

int __ast_rwlock_tryrdlock ( const char *  filename,
int  lineno,
const char *  func,
ast_rwlock_t t,
const char *  name 
)

Definition at line 1178 of file lock.c.

References ast_bt_get_addresses, ast_mark_lock_failed(), AST_MAX_REENTRANCY, AST_RDLOCK, ast_lock_track::backtrace, ast_lock_track::file, ast_lock_track::func, ast_lock_track::lineno, ast_rwlock_info::lock, NULL, ast_lock_track::reentrancy, ast_lock_track::thread_id, and tmp().

Referenced by __ao2_trylock().

1179 {
1180  int res;
1181 
1182 #ifdef DEBUG_THREADS
1183  struct ast_lock_track *lt = ast_get_reentrancy(&t->track, &t->flags, 0);
1184  struct ast_bt *bt = NULL;
1185 
1186  if (lt) {
1187 #ifdef HAVE_BKTR
1188  struct ast_bt tmp;
1189 
1190  /* The implementation of backtrace() may have its own locks.
1191  * Capture the backtrace outside of the reentrancy lock to
1192  * avoid deadlocks. See ASTERISK-22455. */
1194 
1195  ast_reentrancy_lock(lt);
1196  if (lt->reentrancy < AST_MAX_REENTRANCY) {
1197  lt->backtrace[lt->reentrancy] = tmp;
1198  bt = &lt->backtrace[lt->reentrancy];
1199  }
1200  ast_reentrancy_unlock(lt);
1201 #endif
1202  ast_store_lock_info(AST_RDLOCK, filename, line, func, name, t, bt);
1203  }
1204 #endif /* DEBUG_THREADS */
1205 
1206  res = pthread_rwlock_tryrdlock(&t->lock);
1207 
1208 #ifdef DEBUG_THREADS
1209  if (!res && lt) {
1210  ast_reentrancy_lock(lt);
1211  if (lt->reentrancy < AST_MAX_REENTRANCY) {
1212  lt->file[lt->reentrancy] = filename;
1213  lt->lineno[lt->reentrancy] = line;
1214  lt->func[lt->reentrancy] = func;
1215  lt->thread_id[lt->reentrancy] = pthread_self();
1216  lt->reentrancy++;
1217  }
1218  ast_reentrancy_unlock(lt);
1219  ast_mark_lock_acquired(t);
1220  } else if (lt) {
1222  }
1223 #endif /* DEBUG_THREADS */
1224 
1225  return res;
1226 }
const char * file[AST_MAX_REENTRANCY]
Definition: lock.h:112
static int tmp()
Definition: bt_open.c:389
int reentrancy
Definition: lock.h:114
#define NULL
Definition: resample.c:96
int lineno[AST_MAX_REENTRANCY]
Definition: lock.h:113
struct ast_bt backtrace[AST_MAX_REENTRANCY]
Definition: lock.h:118
Lock tracking information.
Definition: lock.h:111
const char * func[AST_MAX_REENTRANCY]
Definition: lock.h:115
static const char name[]
Definition: cdr_mysql.c:74
#define AST_MAX_REENTRANCY
Definition: lock.h:101
pthread_t thread_id[AST_MAX_REENTRANCY]
Definition: lock.h:116
void ast_mark_lock_failed(void *lock_addr)
Definition: extconf.c:2314
pthread_rwlock_t lock
Definition: lock.h:157
#define ast_bt_get_addresses(bt)
Definition: backtrace.h:38

◆ __ast_rwlock_trywrlock()

int __ast_rwlock_trywrlock ( const char *  filename,
int  lineno,
const char *  func,
ast_rwlock_t t,
const char *  name 
)

Definition at line 1228 of file lock.c.

References ast_bt_get_addresses, ast_mark_lock_failed(), AST_MAX_REENTRANCY, AST_WRLOCK, ast_lock_track::backtrace, ast_lock_track::file, ast_lock_track::func, ast_lock_track::lineno, ast_rwlock_info::lock, NULL, ast_lock_track::reentrancy, ast_lock_track::thread_id, and tmp().

Referenced by __ao2_trylock().

1229 {
1230  int res;
1231 
1232 #ifdef DEBUG_THREADS
1233  struct ast_lock_track *lt = ast_get_reentrancy(&t->track, &t->flags, 0);
1234  struct ast_bt *bt = NULL;
1235 
1236  if (lt) {
1237 #ifdef HAVE_BKTR
1238  struct ast_bt tmp;
1239 
1240  /* The implementation of backtrace() may have its own locks.
1241  * Capture the backtrace outside of the reentrancy lock to
1242  * avoid deadlocks. See ASTERISK-22455. */
1244 
1245  ast_reentrancy_lock(lt);
1246  if (lt->reentrancy < AST_MAX_REENTRANCY) {
1247  lt->backtrace[lt->reentrancy] = tmp;
1248  bt = &lt->backtrace[lt->reentrancy];
1249  }
1250  ast_reentrancy_unlock(lt);
1251 #endif
1252  ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt);
1253  }
1254 #endif /* DEBUG_THREADS */
1255 
1256  res = pthread_rwlock_trywrlock(&t->lock);
1257 
1258 #ifdef DEBUG_THREADS
1259  if (!res && lt) {
1260  ast_reentrancy_lock(lt);
1261  if (lt->reentrancy < AST_MAX_REENTRANCY) {
1262  lt->file[lt->reentrancy] = filename;
1263  lt->lineno[lt->reentrancy] = line;
1264  lt->func[lt->reentrancy] = func;
1265  lt->thread_id[lt->reentrancy] = pthread_self();
1266  lt->reentrancy++;
1267  }
1268  ast_reentrancy_unlock(lt);
1269  ast_mark_lock_acquired(t);
1270  } else if (lt) {
1272  }
1273 #endif /* DEBUG_THREADS */
1274 
1275  return res;
1276 }
const char * file[AST_MAX_REENTRANCY]
Definition: lock.h:112
static int tmp()
Definition: bt_open.c:389
int reentrancy
Definition: lock.h:114
#define NULL
Definition: resample.c:96
int lineno[AST_MAX_REENTRANCY]
Definition: lock.h:113
struct ast_bt backtrace[AST_MAX_REENTRANCY]
Definition: lock.h:118
Lock tracking information.
Definition: lock.h:111
const char * func[AST_MAX_REENTRANCY]
Definition: lock.h:115
static const char name[]
Definition: cdr_mysql.c:74
#define AST_MAX_REENTRANCY
Definition: lock.h:101
pthread_t thread_id[AST_MAX_REENTRANCY]
Definition: lock.h:116
void ast_mark_lock_failed(void *lock_addr)
Definition: extconf.c:2314
pthread_rwlock_t lock
Definition: lock.h:157
#define ast_bt_get_addresses(bt)
Definition: backtrace.h:38

◆ __ast_rwlock_unlock()

int __ast_rwlock_unlock ( const char *  filename,
int  lineno,
const char *  func,
ast_rwlock_t t,
const char *  name 
)

Definition at line 748 of file lock.c.

References __AST_RWLOCK_INIT_VALUE, AST_PTHREADT_NULL, ast_lock_track::backtrace, ast_lock_track::file, ast_lock_track::func, ast_lock_track::lineno, ast_rwlock_info::lock, NULL, ast_lock_track::reentrancy, and ast_lock_track::thread_id.

Referenced by __ao2_global_obj_ref(), __ao2_global_obj_replace(), __ao2_unlock(), and __ast_heap_unlock().

749 {
750  int res;
751 
752 #ifdef DEBUG_THREADS
753  struct ast_lock_track *lt = NULL;
754  int canlog = t->flags.tracking && strcmp(filename, "logger.c");
755  struct ast_bt *bt = NULL;
756  int lock_found = 0;
757 
758 #if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
759  if ((t->lock) == ((pthread_rwlock_t) __AST_RWLOCK_INIT_VALUE)) {
760  log_mutex_error(canlog, "%s line %d (%s): Warning: rwlock '%s' is uninitialized.\n",
761  filename, line, func, name);
762  DO_THREAD_CRASH;
763  return EINVAL;
764  }
765 #endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
766 
767  lt = ast_get_reentrancy(&t->track, &t->flags, 0);
768  if (lt) {
769  ast_reentrancy_lock(lt);
770  if (lt->reentrancy) {
771  int i;
772  pthread_t self = pthread_self();
773  for (i = lt->reentrancy - 1; i >= 0; --i) {
774  if (lt->thread_id[i] == self) {
775  lock_found = 1;
776  if (i != lt->reentrancy - 1) {
777  lt->file[i] = lt->file[lt->reentrancy - 1];
778  lt->lineno[i] = lt->lineno[lt->reentrancy - 1];
779  lt->func[i] = lt->func[lt->reentrancy - 1];
780  lt->thread_id[i] = lt->thread_id[lt->reentrancy - 1];
781  }
782 #ifdef HAVE_BKTR
783  bt = &lt->backtrace[i];
784 #endif
785  lt->file[lt->reentrancy - 1] = NULL;
786  lt->lineno[lt->reentrancy - 1] = 0;
787  lt->func[lt->reentrancy - 1] = NULL;
788  lt->thread_id[lt->reentrancy - 1] = AST_PTHREADT_NULL;
789  break;
790  }
791  }
792  }
793 
794  if (lock_found && --lt->reentrancy < 0) {
795  log_mutex_error(canlog, "%s line %d (%s): rwlock '%s' freed more times than we've locked!\n",
796  filename, line, func, name);
797  lt->reentrancy = 0;
798  }
799 
800  ast_reentrancy_unlock(lt);
801 
802  ast_remove_lock_info(t, bt);
803  }
804 #endif /* DEBUG_THREADS */
805 
806  res = pthread_rwlock_unlock(&t->lock);
807 
808 #ifdef DEBUG_THREADS
809  if (res) {
810  log_mutex_error(canlog, "%s line %d (%s): Error releasing rwlock: %s\n",
811  filename, line, func, strerror(res));
812  DO_THREAD_CRASH;
813  }
814 #endif /* DEBUG_THREADS */
815 
816  return res;
817 }
const char * file[AST_MAX_REENTRANCY]
Definition: lock.h:112
#define __AST_RWLOCK_INIT_VALUE
Definition: lock.h:84
int reentrancy
Definition: lock.h:114
#define NULL
Definition: resample.c:96
int lineno[AST_MAX_REENTRANCY]
Definition: lock.h:113
struct ast_bt backtrace[AST_MAX_REENTRANCY]
Definition: lock.h:118
Lock tracking information.
Definition: lock.h:111
#define AST_PTHREADT_NULL
Definition: lock.h:66
const char * func[AST_MAX_REENTRANCY]
Definition: lock.h:115
static const char name[]
Definition: cdr_mysql.c:74
pthread_t thread_id[AST_MAX_REENTRANCY]
Definition: lock.h:116
pthread_rwlock_t lock
Definition: lock.h:157

◆ __ast_rwlock_wrlock()

int __ast_rwlock_wrlock ( const char *  filename,
int  lineno,
const char *  func,
ast_rwlock_t t,
const char *  name 
)

Definition at line 917 of file lock.c.

References ast_bt_get_addresses, AST_MAX_REENTRANCY, AST_WRLOCK, ast_lock_track::backtrace, ast_lock_track::file, ast_lock_track::func, ast_lock_track::lineno, ast_rwlock_info::lock, NULL, ast_lock_track::reentrancy, ast_lock_track::thread_id, and tmp().

Referenced by __ao2_global_obj_replace(), __ao2_lock(), and __ast_heap_wrlock().

918 {
919  int res;
920 
921 #ifdef DEBUG_THREADS
922  struct ast_lock_track *lt = ast_get_reentrancy(&t->track, &t->flags, 0);
923  int canlog = t->flags.tracking && strcmp(filename, "logger.c");
924  struct ast_bt *bt = NULL;
925 
926  if (lt) {
927 #ifdef HAVE_BKTR
928  struct ast_bt tmp;
929 
930  /* The implementation of backtrace() may have its own locks.
931  * Capture the backtrace outside of the reentrancy lock to
932  * avoid deadlocks. See ASTERISK-22455. */
934 
935  ast_reentrancy_lock(lt);
936  if (lt->reentrancy < AST_MAX_REENTRANCY) {
937  lt->backtrace[lt->reentrancy] = tmp;
938  bt = &lt->backtrace[lt->reentrancy];
939  }
940  ast_reentrancy_unlock(lt);
941 #endif
942  ast_store_lock_info(AST_WRLOCK, filename, line, func, name, t, bt);
943  }
944 #endif /* DEBUG_THREADS */
945 
946 #if defined(DETECT_DEADLOCKS) && defined(DEBUG_THREADS)
947  {
948  time_t seconds = time(NULL);
949  time_t wait_time, reported_wait = 0;
950  do {
951  res = pthread_rwlock_trywrlock(&t->lock);
952  if (res == EBUSY) {
953  wait_time = time(NULL) - seconds;
954  if (wait_time > reported_wait && (wait_time % 5) == 0) {
955  log_mutex_error(canlog, "%s line %d (%s): Deadlock? waited %d sec for writelock '%s'?\n",
956  filename, line, func, (int)wait_time, name);
957  if (lt) {
958  ast_reentrancy_lock(lt);
959 #ifdef HAVE_BKTR
960  __dump_backtrace(&lt->backtrace[lt->reentrancy], canlog);
961 #endif
962  log_mutex_error(canlog, "%s line %d (%s): '%s' was locked here.\n",
963  lt->file[lt->reentrancy-1], lt->lineno[lt->reentrancy-1],
964  lt->func[lt->reentrancy-1], name);
965 #ifdef HAVE_BKTR
966  __dump_backtrace(&lt->backtrace[lt->reentrancy-1], canlog);
967 #endif
968  ast_reentrancy_unlock(lt);
969  }
970  reported_wait = wait_time;
971  }
972  usleep(200);
973  }
974  } while (res == EBUSY);
975  }
976 #else /* !DETECT_DEADLOCKS || !DEBUG_THREADS */
977  res = pthread_rwlock_wrlock(&t->lock);
978 #endif /* !DETECT_DEADLOCKS || !DEBUG_THREADS */
979 
980 #ifdef DEBUG_THREADS
981  if (!res && lt) {
982  ast_reentrancy_lock(lt);
983  if (lt->reentrancy < AST_MAX_REENTRANCY) {
984  lt->file[lt->reentrancy] = filename;
985  lt->lineno[lt->reentrancy] = line;
986  lt->func[lt->reentrancy] = func;
987  lt->thread_id[lt->reentrancy] = pthread_self();
988  lt->reentrancy++;
989  }
990  ast_reentrancy_unlock(lt);
991  ast_mark_lock_acquired(t);
992  } else if (lt) {
993 #ifdef HAVE_BKTR
994  if (lt->reentrancy) {
995  ast_reentrancy_lock(lt);
996  bt = &lt->backtrace[lt->reentrancy-1];
997  ast_reentrancy_unlock(lt);
998  } else {
999  bt = NULL;
1000  }
1001 #endif
1002  ast_remove_lock_info(t, bt);
1003  }
1004  if (res) {
1005  log_mutex_error(canlog, "%s line %d (%s): Error obtaining write lock: %s\n",
1006  filename, line, func, strerror(res));
1007  DO_THREAD_CRASH;
1008  }
1009 #endif /* DEBUG_THREADS */
1010 
1011  return res;
1012 }
const char * file[AST_MAX_REENTRANCY]
Definition: lock.h:112
static int tmp()
Definition: bt_open.c:389
int reentrancy
Definition: lock.h:114
#define NULL
Definition: resample.c:96
int lineno[AST_MAX_REENTRANCY]
Definition: lock.h:113
struct ast_bt backtrace[AST_MAX_REENTRANCY]
Definition: lock.h:118
Lock tracking information.
Definition: lock.h:111
const char * func[AST_MAX_REENTRANCY]
Definition: lock.h:115
static const char name[]
Definition: cdr_mysql.c:74
#define AST_MAX_REENTRANCY
Definition: lock.h:101
pthread_t thread_id[AST_MAX_REENTRANCY]
Definition: lock.h:116
pthread_rwlock_t lock
Definition: lock.h:157
#define ast_bt_get_addresses(bt)
Definition: backtrace.h:38

◆ ast_atomic_dec_and_test()

int ast_atomic_dec_and_test ( volatile int *  p)
inline

decrement *p by 1 and return true if the variable has reached 0.

Useful e.g. to check if a refcount has reached 0.

Definition at line 765 of file lock.h.

Referenced by dispose_conf(), iax2_process_thread_cleanup(), run_station(), and sla_station_exec().

◆ ast_atomic_fetchadd_int()

int ast_atomic_fetchadd_int ( volatile int *  p,
int  v 
)
inline

Atomically add v to *p and return the previous value of *p.

This can be used to handle reference counts, and the return value can be used to generate unique identifiers.

Definition at line 755 of file lock.h.

References ast_atomic_sub_fetch.

Referenced by __ao2_link(), __ao2_lock(), __ao2_ref(), __ao2_trylock(), __ao2_unlock(), __ast_channel_alloc_ap(), __ast_channel_internal_alloc(), __ast_module_ref(), __ast_module_unref(), __ast_module_user_add(), __ast_module_user_hangup_all(), __ast_module_user_remove(), __container_unlink_node_debug(), __manager_event_sessions_va(), _sip_tcp_helper_thread(), accept_thread(), acf_odbc_read(), action_login(), admin_exec(), advance_event(), ao2_container_count(), append_event(), ast_bridge_interval_hook(), ast_channel_destructor(), ast_channel_internal_setup_topics(), ast_cli_command_full(), ast_create_callid(), ast_odbc_execute_sql(), ast_odbc_prepare(), ast_odbc_prepare_and_execute(), ast_odbc_smart_execute(), ast_sip_schedule_task(), ast_taskprocessor_seq_num(), AST_TEST_DEFINE(), ast_undestroyed_channels(), ast_unreal_new_channels(), authenticate_verify(), bridge_channel_handle_interval(), bridge_channel_queue_action_data_sync(), build_conf(), build_peer(), cc_device_monitor_init(), cc_extension_monitor_init(), cc_interfaces_datastore_init(), cdr_object_alloc(), chan_pjsip_new(), container_destruct(), create_new_sip_etag(), dahdi_destroy(), dahdi_request(), dahdi_translate(), destroy_session(), dial_append_common(), dispatch_message(), dns_query_set_callback(), dundi_query_read(), enum_query_read(), fax_session_new(), fax_session_release(), fax_session_reserve(), find_idle_thread(), find_load_queue_rt_friendly(), find_session(), find_transcoders(), generate_msg_id(), generic_fax_exec(), grab_last(), handle_message(), hash_ao2_container_init(), hash_test_grow(), hash_test_lookup(), hook_read(), ht_delete(), ht_new(), httpd_helper_thread(), iax2_destroy_helper(), iax2_process_thread(), iax_frame_free(), iax_frame_new(), inprocess_count(), internal_ao2_alloc(), internal_stasis_subscribe(), pjsip_history_entry_alloc(), publish_msg(), pubsub_on_rx_publish_request(), rb_ao2_container_init(), rec_request(), receivefax_exec(), reload_single_queue(), run_station(), sendfax_exec(), session_destructor(), session_do(), sip_create_publication(), sip_destroy_peer(), sip_new(), sip_peer_hold(), sla_add_trunk_to_station(), sla_handle_hold_event(), sla_station_exec(), smdi_msg_retrieve_read(), spandsp_fax_switch_to_t38(), stasis_app_control_snoop(), stasis_caching_topic_create(), stasis_cp_all_create(), stasis_message_type_create(), temp_peer(), transport_create(), try_merge_optimize_out(), try_swap_optimize_out(), update_stats(), and worker_thread_alloc().

763 {