Wed Mar 3 23:01:31 2010

Asterisk developer's documentation


lock.h File Reference

Asterisk locking-related definitions:

More...

#include <pthread.h>
#include <time.h>
#include <sys/param.h>
#include <execinfo.h>
#include "asterisk/logger.h"
#include "asterisk/inline_api.h"
Include dependency graph for lock.h:

Go to the source code of this file.

Defines

#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 __MTX_PROF(a)   return pthread_mutex_lock((a))
#define ast_channel_lock(x)   ast_mutex_lock(&x->lock_dont_use)
 Lock a channel. If DEBUG_CHANNEL_LOCKS is defined in the Makefile, print relevant output for debugging.
#define ast_channel_trylock(x)   ast_mutex_trylock(&x->lock_dont_use)
 Try locking a channel. If DEBUG_CHANNEL_LOCKS is defined in the Makefile, print relevant output for debugging.
#define ast_channel_unlock(x)   ast_mutex_unlock(&x->lock_dont_use)
 Unlock a channel. If DEBUG_CHANNEL_LOCKS is defined in the Makefile, print relevant output for debugging.
#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_init_notracking(m)   ast_mutex_init(m)
#define AST_MUTEX_INIT_VALUE   ((ast_mutex_t) PTHREAD_MUTEX_INIT_VALUE)
#define AST_MUTEX_INIT_VALUE_NOTRACKING   ((ast_mutex_t) PTHREAD_MUTEX_INIT_VALUE)
#define AST_MUTEX_INITIALIZER   __use_AST_MUTEX_DEFINE_STATIC_rather_than_AST_MUTEX_INITIALIZER__
#define AST_MUTEX_KIND   PTHREAD_MUTEX_RECURSIVE_NP
#define ast_pthread_mutex_init(pmutex, a)   pthread_mutex_init(pmutex,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_init_notracking(a)   ast_rwlock_init(a)
#define AST_RWLOCK_INIT_VALUE   PTHREAD_RWLOCK_INITIALIZER
#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

Typedefs

typedef pthread_cond_t ast_cond_t
typedef pthread_mutex_t ast_mutex_t
typedef pthread_rwlock_t ast_rwlock_t

Functions

int ast_atomic_dec_and_test (volatile int *p)
 decrement *p by 1 and return true if the variable has reached 0. Useful e.g. to check if a refcount has reached 0.
int ast_atomic_fetchadd_int (volatile int *p, int v)
 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.
int ast_atomic_fetchadd_int_slow (volatile int *p, int v)
static int ast_cond_broadcast (ast_cond_t *cond)
static int ast_cond_destroy (ast_cond_t *cond)
static int ast_cond_init (ast_cond_t *cond, pthread_condattr_t *cond_attr)
static int ast_cond_signal (ast_cond_t *cond)
static int ast_cond_timedwait (ast_cond_t *cond, ast_mutex_t *t, const struct timespec *abstime)
static int ast_cond_wait (ast_cond_t *cond, ast_mutex_t *t)
static int ast_mutex_destroy (ast_mutex_t *pmutex)
static int ast_mutex_init (ast_mutex_t *pmutex)
static int ast_mutex_lock (ast_mutex_t *pmutex)
static int ast_mutex_trylock (ast_mutex_t *pmutex)
static int ast_mutex_unlock (ast_mutex_t *pmutex)
static int ast_rwlock_destroy (ast_rwlock_t *prwlock)
static int ast_rwlock_init (ast_rwlock_t *prwlock)
static int ast_rwlock_rdlock (ast_rwlock_t *prwlock)
static int ast_rwlock_timedrdlock (ast_rwlock_t *prwlock, const struct timespec *abs_timeout)
static int ast_rwlock_timedwrlock (ast_rwlock_t *prwlock, const struct timespec *abs_timeout)
static int ast_rwlock_tryrdlock (ast_rwlock_t *prwlock)
static int ast_rwlock_trywrlock (ast_rwlock_t *prwlock)
static int ast_rwlock_unlock (ast_rwlock_t *prwlock)
static int ast_rwlock_wrlock (ast_rwlock_t *prwlock)

Detailed Description

Asterisk locking-related definitions:

Definition in file lock.h.


Define Documentation

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

Definition at line 1882 of file lock.h.

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

Definition at line 1929 of file lock.h.

#define __MTX_PROF (  )     return pthread_mutex_lock((a))

Definition at line 67 of file lock.h.

Referenced by ast_mutex_lock().

#define ast_channel_lock (  )     ast_mutex_lock(&x->lock_dont_use)

Lock a channel. If DEBUG_CHANNEL_LOCKS is defined in the Makefile, print relevant output for debugging.

Definition at line 2030 of file lock.h.

Referenced by __ast_answer(), __ast_queue_frame(), __oh323_destroy(), __sip_destroy(), _macro_exec(), _while_exec(), action_redirect(), add_features_datastores(), add_to_agi(), agent_hangup(), agent_indicate(), ast_activate_generator(), ast_async_goto(), ast_audiohook_attach(), ast_audiohook_detach_source(), ast_audiohook_remove(), ast_autoservice_start(), ast_autoservice_stop(), ast_bridge_call(), ast_call(), ast_call_forward(), ast_channel_free(), ast_channel_masquerade(), ast_check_hangup_locked(), ast_deactivate_generator(), ast_dial_join(), ast_do_masquerade(), ast_eivr_getvariable(), ast_explicit_goto(), ast_feature_interpret(), ast_hangup(), ast_indicate_data(), ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_raw_answer(), ast_read_generator_actions(), ast_rtp_bridge(), ast_rtp_early_bridge(), ast_rtp_make_compatible(), ast_set_callerid(), ast_settimeout(), ast_softhangup(), ast_stopstream(), ast_transfer(), ast_udptl_bridge(), ast_waitfor_nandfds(), ast_write(), bridge_play_sounds(), builtin_atxfer(), builtin_automixmonitor(), callerid_read(), callerid_write(), channel_spy(), common_exec(), conf_run(), conf_start_moh(), dahdi_bridge(), dahdi_call(), dahdi_handle_dtmfup(), dial_exec_full(), dialog_unlink_all(), disable_jack_hook(), do_bridge_masquerade(), do_forward(), do_timelimit(), dundi_query_read(), dundi_result_read(), enable_jack_hook(), end_bridge_callback(), enum_query_read(), enum_result_read(), func_channel_read(), func_channel_write(), func_header_read(), func_inheritance_write(), function_sipchaninfo_read(), generator_force(), get_agi_cmd(), handle_request_invite(), init_jack_data(), jack_hook_callback(), leave_voicemail(), local_hangup(), local_read(), login_exec(), lua_get_state(), manage_parkinglot(), minivm_delete_exec(), minivm_notify_exec(), morsecode_exec(), notify_new_message(), p2p_callback_disable(), park_exec_full(), pbx_builtin_getvar_helper(), pbx_builtin_pushvar_helper(), pbx_builtin_serialize_variables(), pbx_builtin_setvar_helper(), pbx_retrieve_variable(), queue_exec(), retrydial_exec(), ring_entry(), run_agi(), sendtext_exec(), set_ext_pri(), set_format(), setup_inheritance_datastore(), setup_mixmonitor_ds(), setup_transfer_datastore(), shared_read(), shared_write(), sip_addheader(), sip_dtmfmode(), sip_park(), sip_park_thread(), smdi_msg_read(), smdi_msg_retrieve_read(), speech_background(), speex_callback(), speex_read(), speex_write(), transmit_invite(), try_calling(), update_bridge_vars(), and wait_for_answer().

#define ast_channel_trylock (  )     ast_mutex_trylock(&x->lock_dont_use)
#define ast_channel_unlock (  )     ast_mutex_unlock(&x->lock_dont_use)

Unlock a channel. If DEBUG_CHANNEL_LOCKS is defined in the Makefile, print relevant output for debugging.

Definition at line 2033 of file lock.h.

Referenced by __ast_answer(), __ast_queue_frame(), __ast_read(), __oh323_destroy(), __oh323_rtp_create(), __sip_destroy(), _macro_exec(), _while_exec(), acf_import(), action_add_agi_cmd(), action_atxfer(), action_bridge(), action_coreshowchannels(), action_getvar(), action_hangup(), action_redirect(), action_sendtext(), action_setvar(), action_status(), action_timeout(), add_features_datastores(), add_to_agi(), agent_hangup(), agent_indicate(), agent_logoff(), alsa_call(), ast_activate_generator(), ast_async_goto(), ast_async_goto_by_name(), ast_audiohook_attach(), ast_audiohook_detach_source(), ast_audiohook_remove(), ast_autoservice_start(), ast_autoservice_stop(), ast_bridge_call(), ast_call(), ast_call_forward(), ast_channel_free(), ast_channel_masquerade(), ast_check_hangup_locked(), ast_complete_channels(), ast_deactivate_generator(), ast_dial_join(), ast_do_masquerade(), ast_eivr_getvariable(), ast_explicit_goto(), ast_feature_interpret(), ast_hangup(), ast_indicate_data(), ast_park_call_full(), ast_parse_device_state(), ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_pickup_call(), ast_queue_hangup(), ast_queue_hangup_with_cause(), ast_raw_answer(), ast_read_generator_actions(), ast_rtp_bridge(), ast_rtp_early_bridge(), ast_rtp_make_compatible(), ast_set_callerid(), ast_settimeout(), ast_softhangup(), ast_stopstream(), ast_transfer(), ast_udptl_bridge(), ast_waitfor_nandfds(), ast_write(), asyncgoto_exec(), attempt_transfer(), auto_congest(), bridge_exec(), bridge_native_loop(), bridge_p2p_loop(), bridge_play_sounds(), builtin_atxfer(), builtin_automixmonitor(), callerid_read(), callerid_write(), change_monitor_action(), channel_spy(), chanspy_ds_free(), check_bridge(), check_rtp_timeout(), cleanup_connection(), common_exec(), conf_exec(), conf_run(), conf_start_moh(), console_answer(), console_hangup(), console_sendtext(), dahdi_bridge(), dahdi_call(), dahdi_handle_dtmfup(), dahdi_handle_event(), dahdi_queue_frame(), dahdi_softhangup_all(), dial_exec_full(), dialog_unlink_all(), disable_jack_hook(), do_bridge_masquerade(), do_forward(), do_pause_or_unpause(), do_timelimit(), dundi_query_read(), dundi_result_read(), enable_jack_hook(), end_bridge_callback(), enum_query_read(), enum_result_read(), fast_originate(), func_channel_read(), func_channel_write(), func_channels_read(), func_header_read(), func_inheritance_write(), function_sipchaninfo_read(), generator_force(), get_agi_cmd(), handle_chanlist(), handle_channelstatus(), handle_cli_agi_add_cmd(), handle_cli_mixmonitor(), handle_core_set_debug_channel(), handle_getvariablefull(), handle_hangup(), handle_invite_replaces(), handle_request_bye(), handle_request_do(), handle_request_invite(), handle_request_refer(), handle_set_chanvar(), handle_show_chanvar(), handle_showchan(), handle_softhangup(), hangup_connection(), iax2_destroy(), iax2_queue_control_data(), iax2_queue_frame(), iax2_queue_hangup(), init_jack_data(), jack_hook_callback(), leave_voicemail(), local_attended_transfer(), local_hangup(), local_queue_frame(), local_read(), login_exec(), lua_get_state(), manage_parkinglot(), manager_park(), manager_play_dtmf(), mgcp_queue_frame(), mgcp_queue_hangup(), minivm_delete_exec(), minivm_notify_exec(), morsecode_exec(), my_ast_get_channel_by_name_locked(), next_channel(), notify_new_message(), oh323_rtp_read(), oh323_simulate_dtmf_end(), p2p_callback_disable(), park_exec_full(), pbx_builtin_getvar_helper(), pbx_builtin_importvar(), pbx_builtin_pushvar_helper(), pbx_builtin_serialize_variables(), pbx_builtin_setvar_helper(), pbx_retrieve_variable(), pickup_by_channel(), pickup_by_exten(), pickup_by_mark(), pri_hangup_all(), proc_session_timer(), queue_exec(), receive_digit(), remote_hold(), retrans_pkt(), retrydial_exec(), ring_entry(), run_agi(), scheduler_process_request_queue(), sendtext_exec(), set_ext_pri(), set_format(), setup_chanspy_ds(), setup_inheritance_datastore(), setup_mixmonitor_ds(), setup_rtp_connection(), setup_transfer_datastore(), shared_read(), shared_write(), sip_addheader(), sip_dtmfmode(), sip_hangup(), sip_park(), sip_park_thread(), smdi_msg_read(), smdi_msg_retrieve_read(), socket_process(), softhangup_exec(), speech_background(), speex_callback(), speex_read(), speex_write(), start_monitor_action(), stop_monitor_action(), transmit_invite(), try_calling(), try_suggested_sip_codec(), update_bridge_vars(), update_state(), wait_for_answer(), and wakeup_sub().

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

Definition at line 1901 of file lock.h.

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

Definition at line 1902 of file lock.h.

#define ast_mutex_init_notracking (  )     ast_mutex_init(m)

Definition at line 1689 of file lock.h.

#define AST_MUTEX_INIT_VALUE   ((ast_mutex_t) PTHREAD_MUTEX_INIT_VALUE)

Definition at line 1686 of file lock.h.

#define AST_MUTEX_INIT_VALUE_NOTRACKING   ((ast_mutex_t) PTHREAD_MUTEX_INIT_VALUE)

Definition at line 1687 of file lock.h.

#define AST_MUTEX_INITIALIZER   __use_AST_MUTEX_DEFINE_STATIC_rather_than_AST_MUTEX_INITIALIZER__

Definition at line 1904 of file lock.h.

#define AST_MUTEX_KIND   PTHREAD_MUTEX_RECURSIVE_NP

Definition at line 93 of file lock.h.

Referenced by ast_mutex_init(), and dummy_start().

#define ast_pthread_mutex_init ( pmutex,
 )     pthread_mutex_init(pmutex,a)

Definition at line 1704 of file lock.h.

#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)

Definition at line 1933 of file lock.h.

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

Definition at line 1934 of file lock.h.

#define ast_rwlock_init_notracking (  )     ast_rwlock_init(a)

Definition at line 1767 of file lock.h.

#define AST_RWLOCK_INIT_VALUE   PTHREAD_RWLOCK_INITIALIZER

Definition at line 1762 of file lock.h.

#define CHANNEL_DEADLOCK_AVOIDANCE ( chan   ) 
#define DEADLOCK_AVOIDANCE ( lock   ) 
#define DLA_LOCK ( lock   )     ast_mutex_lock(lock)

Definition at line 1682 of file lock.h.

Referenced by dahdi_handle_event().

#define DLA_UNLOCK ( lock   )     ast_mutex_unlock(lock)

Definition at line 1680 of file lock.h.

Referenced by dahdi_handle_event().

#define gethostbyname   __gethostbyname__is__not__reentrant__use__ast_gethostbyname__instead__

Definition at line 1906 of file lock.h.

Referenced by connect_sphinx(), and gethostbyname_r().

#define pthread_cond_broadcast   use_ast_cond_broadcast_instead_of_pthread_cond_broadcast

Definition at line 1897 of file lock.h.

Referenced by ast_cond_broadcast().

#define pthread_cond_destroy   use_ast_cond_destroy_instead_of_pthread_cond_destroy

Definition at line 1895 of file lock.h.

Referenced by ast_cond_destroy().

#define pthread_cond_init   use_ast_cond_init_instead_of_pthread_cond_init

Definition at line 1894 of file lock.h.

Referenced by ast_cond_init().

#define pthread_cond_signal   use_ast_cond_signal_instead_of_pthread_cond_signal

Definition at line 1896 of file lock.h.

Referenced by ast_cond_signal().

#define pthread_cond_t   use_ast_cond_t_instead_of_pthread_cond_t

Definition at line 1887 of file lock.h.

#define pthread_cond_timedwait   use_ast_cond_timedwait_instead_of_pthread_cond_timedwait

Definition at line 1899 of file lock.h.

Referenced by ast_cond_timedwait().

#define pthread_cond_wait   use_ast_cond_wait_instead_of_pthread_cond_wait

Definition at line 1898 of file lock.h.

Referenced by ast_cond_wait().

#define pthread_create   __use_ast_pthread_create_instead__

Definition at line 1909 of file lock.h.

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

#define pthread_mutex_destroy   use_ast_mutex_destroy_instead_of_pthread_mutex_destroy

Definition at line 1893 of file lock.h.

Referenced by ast_mutex_destroy(), and stack_destroy().

#define pthread_mutex_init   use_ast_mutex_init_instead_of_pthread_mutex_init

Definition at line 1892 of file lock.h.

Referenced by ast_mutex_init(), dummy_start(), init_bc(), and stack_init().

#define PTHREAD_MUTEX_INIT_VALUE   PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP

Definition at line 92 of file lock.h.

#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

Definition at line 1886 of file lock.h.

#define pthread_mutex_trylock   use_ast_mutex_trylock_instead_of_pthread_mutex_trylock

Definition at line 1891 of file lock.h.

Referenced by ast_mutex_trylock().

#define pthread_mutex_unlock   use_ast_mutex_unlock_instead_of_pthread_mutex_unlock

Typedef Documentation

typedef pthread_cond_t ast_cond_t

Definition at line 1726 of file lock.h.

typedef pthread_mutex_t ast_mutex_t

Definition at line 1684 of file lock.h.

typedef pthread_rwlock_t ast_rwlock_t

Definition at line 1759 of file lock.h.


Function Documentation

int ast_atomic_dec_and_test ( volatile int *  p  ) 

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 2009 of file lock.h.

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

02012 {

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

Definition at line 1690 of file utils.c.

References ast_mutex_lock(), and ast_mutex_unlock().

01691 {
01692    int ret;
01693    ast_mutex_lock(&fetchadd_m);
01694    ret = *p;
01695    *p += v;
01696    ast_mutex_unlock(&fetchadd_m);
01697    return ret;
01698 }

static int ast_cond_broadcast ( ast_cond_t cond  )  [inline, static]
static int ast_cond_destroy ( ast_cond_t cond  )  [inline, static]
static int ast_cond_init ( ast_cond_t cond,
pthread_condattr_t *  cond_attr 
) [inline, static]
static int ast_cond_signal ( ast_cond_t cond  )  [inline, static]
static int ast_cond_timedwait ( ast_cond_t cond,
ast_mutex_t t,
const struct timespec *  abstime 
) [inline, static]
static int ast_cond_wait ( ast_cond_t cond,
ast_mutex_t t 
) [inline, static]
static int ast_mutex_destroy ( ast_mutex_t pmutex  )  [inline, static]
static int ast_mutex_init ( ast_mutex_t pmutex  )  [inline, static]
static int ast_mutex_lock ( ast_mutex_t pmutex  )  [inline, static]

Definition at line 1716 of file lock.h.

References __MTX_PROF.

Referenced by __attempt_transmit(), __auth_reject(), __auto_congest(), __auto_hangup(), __find_callno(), __get_from_jb(), __iax2_poke_noanswer(), __manager_event(), __oh323_new(), __send_lagrq(), __send_ping(), __sip_xmit(), __unload_module(), _sip_tcp_helper_thread(), acf_channel_read(), acf_channel_write(), action_agents(), action_challenge(), action_dahdishowchannels(), action_waitevent(), agent_ack_sleep(), agent_call(), agent_cont_sleep(), agent_devicestate(), agent_digit_begin(), agent_digit_end(), agent_fixup(), agent_hangup(), agent_indicate(), agent_logoff(), agent_new(), agent_read(), agent_request(), agent_sendhtml(), agent_sendtext(), agent_write(), agents_show(), agents_show_online(), alsa_answer(), alsa_call(), alsa_digit(), alsa_fixup(), alsa_hangup(), alsa_indicate(), alsa_read(), alsa_request(), alsa_text(), alsa_write(), announce_thread(), answer_exec_run(), ao2_lock(), app_exec(), append_mailbox_mapping(), ast_atomic_fetchadd_int_slow(), ast_cdr_detach(), ast_cdr_engine_init(), ast_cdr_submit_batch(), ast_cli_netstats(), ast_config_engine_deregister(), ast_config_engine_register(), ast_context_lockmacro(), ast_db_del(), ast_db_deltree(), ast_db_get(), ast_db_gettree(), ast_db_put(), ast_dial_join(), ast_dnsmgr_changed(), ast_get_enum(), ast_iax2_new(), ast_monitor_start(), ast_odbc_request_obj(), ast_random(), ast_replace_sigchld(), ast_sched_add_variable(), ast_sched_del(), ast_sched_dump(), ast_sched_report(), ast_sched_runq(), ast_sched_wait(), ast_sched_when(), ast_search_dns(), ast_smdi_md_message_push(), ast_smdi_md_message_putback(), ast_smdi_mwi_message_push(), ast_smdi_mwi_message_putback(), ast_taskprocessor_push(), ast_unreplace_sigchld(), astman_verify_session_readpermissions(), astman_verify_session_writepermissions(), auth_reject(), authenticate_reply(), auto_hangup(), blr_ebl(), blr_txt(), build_device(), build_profile(), cb_events(), cdr_handler(), channel_spy(), chanspy_ds_chan_fixup(), chanspy_ds_destroy(), chanspy_ds_free(), check_availability(), check_beep(), cl_dequeue_chan(), cl_queue_chan(), clear_config_maps(), cli_tps_ping(), close_client(), common_exec(), conf_free(), conf_run(), config_handler(), config_pgsql(), console_answer(), console_autoanswer(), console_dial(), console_hangup(), console_sendtext(), create_client(), csv_log(), custom_log(), dahdi_answer(), dahdi_call(), dahdi_digit_begin(), dahdi_digit_end(), dahdi_exception(), dahdi_fixup(), dahdi_func_read(), dahdi_handle_dtmfup(), dahdi_hangup(), dahdi_indicate(), dahdi_pri_error(), dahdi_pri_message(), dahdi_queue_frame(), dahdi_request(), dahdi_restart(), dahdi_send_keypad_facility_exec(), dahdi_set_dnd(), dahdi_set_hwgain(), dahdi_set_swgain(), dahdi_show_channel(), dahdi_show_channels(), dahdi_softhangup_all(), dahdi_unlink(), dahdi_write(), decrease_call_count(), defer_full_frame(), delete_users(), destroy_all_channels(), destroy_all_mailbox_mappings(), destroy_endpoint(), destroy_pgsql(), destroy_table(), devstate_change_collector_cb(), dial_trunk(), dnsmgr_refresh(), do_cdr(), do_monitor(), do_reload(), do_timing(), donodelog(), dp_lookup(), dump_cmd_queues(), dump_queue(), find_call_locked(), find_command(), find_engine(), find_idle_thread(), find_session(), find_subchannel_and_lock(), find_subchannel_by_name(), find_table(), find_tpeer(), function_remote(), generic_http_callback(), get_input(), get_lock(), gethostbyname_r(), gtalk_alloc(), gtalk_answer(), gtalk_digit(), gtalk_fixup(), gtalk_get_rtp_peer(), gtalk_hangup(), gtalk_newcall(), gtalk_read(), gtalk_set_rtp_peer(), gtalk_show_channels(), gtalk_write(), h323_reload(), handle_capabilities_res_message(), handle_cli_core_show_config_mappings(), handle_cli_database_show(), handle_cli_database_showkey(), handle_cli_dialplan_save(), handle_cli_iax2_show_channels(), handle_cli_odbc_show(), handle_cli_osp_show(), handle_deferred_full_frames(), handle_mgcp_audit_endpoint(), handle_mgcp_show_endpoints(), handle_modlist(), handle_pri_set_debug_file(), handle_pri_show_debug(), handle_pri_unset_debug_file(), handle_register_message(), handle_request(), handle_request_do(), handle_speechrecognize(), handle_ss7_block_cic(), handle_ss7_block_linkset(), handle_ss7_unblock_cic(), handle_ss7_unblock_linkset(), hidthread(), iax2_answer(), iax2_bridge(), iax2_call(), iax2_do_register(), iax2_fixup(), iax2_hangup(), iax2_indicate(), iax2_key_rotate(), iax2_poke_peer(), iax2_process_thread(), 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(), increase_call_count(), jingle_alloc(), jingle_answer(), jingle_digit(), jingle_fixup(), jingle_get_rtp_peer(), jingle_hangup(), jingle_newcall(), jingle_read(), jingle_set_rtp_peer(), jingle_show_channels(), jingle_write(), key_main_page(), key_select_extension(), leave_voicemail(), load_config(), load_module(), load_rpt_vars(), local_answer(), local_bridgedchannel(), local_call(), local_digit_begin(), local_digit_end(), local_fixup(), local_hangup(), local_indicate(), local_queue_frame(), local_sendhtml(), local_sendtext(), local_write(), locals_show(), lock_both(), lock_msg_q(), log_jitterstats(), login_exec(), lua_free_extensions(), lua_load_extensions(), lua_reload_extensions(), make_trunk(), mb_poll_thread(), mgcp_answer(), mgcp_call(), mgcp_devicestate(), mgcp_fixup(), mgcp_hangup(), mgcp_indicate(), mgcp_postrequest(), mgcp_read(), mgcp_reload(), mgcp_senddigit_begin(), mgcp_senddigit_end(), mgcp_write(), mgcpsock_read(), misdn_cfg_lock(), misdn_jb_empty(), misdn_jb_fill(), misdn_overlap_dial_task(), mixmonitor_ds_chan_fixup(), mixmonitor_ds_close_fs(), mixmonitor_ds_destroy(), mixmonitor_thread(), mwi_monitor_handler(), mwi_send_thread(), node_lookup(), odbc_obj_connect(), odbc_obj_disconnect(), oh323_alloc(), oh323_answer(), oh323_call(), oh323_destroy(), oh323_digit_begin(), oh323_digit_end(), oh323_fixup(), oh323_get_rtp_peer(), oh323_hangup(), oh323_indicate(), oh323_read(), oh323_request(), oh323_simulate_dtmf_end(), oh323_update_info(), oh323_write(), osp_create_provider(), osp_create_transaction(), osp_get_provider(), osp_unload(), parse_config(), parsing(), peer_destructor(), pgsql_log(), phone_request(), pri_dchannel(), pri_hangup_all(), private_enum_init(), process_events(), process_message(), prune_gateways(), pthread_timer_open(), pvt_destructor(), queue_ringing_trunk(), radio_tune(), rcv_mac_addr(), realtime_destroy_handler(), realtime_handler(), realtime_ldap_base_ap(), realtime_multi_handler(), realtime_multi_pgsql(), realtime_pgsql(), realtime_store_handler(), realtime_update_handler(), recordthread(), register_verify(), registry_authrequest(), release_chan(), release_chan_early(), reload(), reload_agents(), reload_config(), reload_followme(), require_pgsql(), restart_monitor(), retrans_pkt(), rpt_master(), rpt_tele_thread(), rtp_bridge_lock(), run_devstate_collector(), run_station(), save_to_folder(), sched_context_destroy(), sched_thread(), scheduled_destroy(), send_client(), send_command_locked(), send_request(), send_retransmit(), set_config(), set_eventmask(), set_pvt_defaults(), setup_chanspy_ds(), setup_dahdi(), signal_condition(), sip_reload(), skinny_get_rtp_peer(), skinny_hangup(), skinny_read(), skinny_req_parse(), skinny_write(), sla_check_reload(), 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(), speech_background(), sqlite3_log(), sqlite_log(), ss7_linkset(), ss7_start_call(), ss_thread(), start_rtp(), statpost(), stop_poll_thread(), store_config(), store_pgsql(), submit_unscheduled_batch(), tds_load_module(), tds_log(), tds_unload_module(), timing_read(), tps_ping_handler(), tps_processing_function(), tps_taskprocessor_destroy(), tps_taskprocessor_pop(), transmit_response(), tune_write(), unistim_fixup(), unistim_hangup(), unistim_info(), unistim_new(), unistim_read(), unistim_register(), unistim_reload(), unistim_write(), unistimsock_read(), unload_module(), update_ldap(), update_pgsql(), update_registry(), verboser(), vm_execmain(), wakeup_sub(), and writefile().

01717 {
01718    __MTX_PROF(pmutex);
01719 }

static int ast_mutex_trylock ( ast_mutex_t pmutex  )  [inline, static]
static int ast_mutex_unlock ( ast_mutex_t pmutex  )  [inline, static]

Definition at line 1706 of file lock.h.

References pthread_mutex_unlock.

Referenced by __attempt_transmit(), __auth_reject(), __auto_congest(), __auto_hangup(), __find_callno(), __get_from_jb(), __iax2_poke_noanswer(), __manager_event(), __oh323_destroy(), __oh323_new(), __oh323_rtp_create(), __send_lagrq(), __send_ping(), __sip_xmit(), __unload_module(), _sip_tcp_helper_thread(), acf_channel_read(), acf_channel_write(), action_agents(), action_challenge(), action_dahdishowchannels(), action_waitevent(), agent_ack_sleep(), agent_call(), agent_cont_sleep(), agent_devicestate(), agent_digit_begin(), agent_digit_end(), agent_fixup(), agent_hangup(), agent_indicate(), agent_logoff(), agent_new(), agent_read(), agent_request(), agent_sendhtml(), agent_sendtext(), agent_write(), agents_show(), agents_show_online(), alsa_answer(), alsa_call(), alsa_digit(), alsa_fixup(), alsa_hangup(), alsa_indicate(), alsa_read(), alsa_request(), alsa_text(), alsa_write(), announce_thread(), answer_call(), answer_exec_run(), ao2_unlock(), app_exec(), append_mailbox_mapping(), ast_atomic_fetchadd_int_slow(), ast_cdr_detach(), ast_cdr_engine_init(), ast_cdr_submit_batch(), ast_cli_netstats(), ast_config_engine_deregister(), ast_config_engine_register(), ast_context_unlockmacro(), ast_db_del(), ast_db_deltree(), ast_db_get(), ast_db_gettree(), ast_db_put(), ast_dial_join(), ast_dnsmgr_changed(), ast_get_enum(), ast_iax2_new(), ast_module_reload(), ast_monitor_start(), ast_odbc_request_obj(), ast_random(), ast_replace_sigchld(), ast_sched_add_variable(), ast_sched_del(), ast_sched_dump(), ast_sched_report(), ast_sched_runq(), ast_sched_wait(), ast_sched_when(), ast_search_dns(), ast_smdi_md_message_push(), ast_smdi_md_message_putback(), ast_smdi_mwi_message_push(), ast_smdi_mwi_message_putback(), ast_taskprocessor_push(), ast_unreplace_sigchld(), astman_is_authed(), astman_verify_session_readpermissions(), astman_verify_session_writepermissions(), auth_reject(), authenticate_reply(), auto_hangup(), blr_ebl(), blr_txt(), build_device(), build_profile(), cache_get_callno_locked(), cb_events(), cdr_handler(), chan_ringing(), channel_spy(), chanspy_ds_chan_fixup(), chanspy_ds_destroy(), chanspy_ds_free(), check_availability(), check_beep(), check_bridge(), cl_dequeue_chan(), cl_queue_chan(), cleanup_connection(), clear_config_maps(), cli_tps_ping(), close_client(), common_exec(), conf_free(), conf_run(), config_handler(), config_pgsql(), connection_made(), console_answer(), console_autoanswer(), console_dial(), console_hangup(), console_sendtext(), create_client(), csv_log(), custom_log(), dahdi_answer(), dahdi_bridge(), dahdi_call(), dahdi_digit_begin(), dahdi_digit_end(), dahdi_exception(), dahdi_fixup(), dahdi_func_read(), dahdi_handle_dtmfup(), dahdi_hangup(), dahdi_indicate(), dahdi_pri_error(), dahdi_pri_message(), dahdi_queue_frame(), dahdi_read(), dahdi_request(), dahdi_restart(), dahdi_send_keypad_facility_exec(), dahdi_set_dnd(), dahdi_set_hwgain(), dahdi_set_swgain(), dahdi_show_channel(), dahdi_show_channels(), dahdi_softhangup_all(), dahdi_unlink(), dahdi_write(), decrease_call_count(), defer_full_frame(), delete_users(), destroy_all_channels(), destroy_all_mailbox_mappings(), destroy_endpoint(), destroy_pgsql(), destroy_table(), devstate_change_collector_cb(), dial_trunk(), dnsmgr_refresh(), do_cdr(), do_monitor(), do_reload(), do_timing(), donodelog(), dp_lookup(), dump_cmd_queues(), dump_queue(), external_rtp_create(), find_cache(), find_call_locked(), find_command(), find_engine(), find_idle_thread(), find_session(), find_subchannel_and_lock(), find_subchannel_by_name(), find_table(), function_remote(), generic_http_callback(), get_input(), gethostbyname_r(), gtalk_alloc(), gtalk_answer(), gtalk_digit(), gtalk_fixup(), gtalk_get_rtp_peer(), gtalk_hangup(), gtalk_newcall(), gtalk_read(), gtalk_set_rtp_peer(), gtalk_show_channels(), gtalk_write(), h323_reload(), handle_capabilities_res_message(), handle_cli_core_show_config_mappings(), handle_cli_database_show(), handle_cli_database_showkey(), handle_cli_dialplan_save(), handle_cli_iax2_show_channels(), handle_cli_odbc_show(), handle_cli_osp_show(), handle_cli_realtime_pgsql_cache(), handle_deferred_full_frames(), handle_mgcp_audit_endpoint(), handle_mgcp_show_endpoints(), handle_modlist(), handle_pri_set_debug_file(), handle_pri_show_debug(), handle_pri_unset_debug_file(), handle_register_message(), handle_request(), handle_request_do(), handle_speechrecognize(), handle_ss7_block_cic(), handle_ss7_block_linkset(), handle_ss7_unblock_cic(), handle_ss7_unblock_linkset(), hangup_connection(), hidthread(), iax2_answer(), iax2_bridge(), iax2_call(), iax2_do_register(), iax2_fixup(), iax2_hangup(), iax2_indicate(), iax2_key_rotate(), iax2_poke_peer(), iax2_process_thread(), iax2_provision(), 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(), increase_call_count(), jingle_alloc(), jingle_answer(), jingle_digit(), jingle_fixup(), jingle_get_rtp_peer(), jingle_hangup(), jingle_newcall(), jingle_read(), jingle_set_rtp_peer(), jingle_show_channels(), jingle_write(), key_main_page(), key_select_extension(), ldap_loadentry(), leave_voicemail(), load_config(), load_module(), load_rpt_vars(), local_answer(), local_bridgedchannel(), local_call(), local_digit_begin(), local_digit_end(), local_fixup(), local_hangup(), local_indicate(), local_queue_frame(), local_sendhtml(), local_sendtext(), local_write(), locals_show(), lock_free(), log_jitterstats(), login_exec(), lua_free_extensions(), lua_load_extensions(), lua_reload_extensions(), make_trunk(), mb_poll_thread(), mgcp_answer(), mgcp_call(), mgcp_devicestate(), mgcp_fixup(), mgcp_hangup(), mgcp_indicate(), mgcp_postrequest(), mgcp_read(), mgcp_reload(), mgcp_request(), mgcp_senddigit_begin(), mgcp_senddigit_end(), mgcp_write(), mgcpsock_read(), misdn_cfg_unlock(), misdn_jb_empty(), misdn_jb_fill(), misdn_overlap_dial_task(), mixmonitor_ds_chan_fixup(), mixmonitor_ds_close_fs(), mixmonitor_ds_destroy(), mixmonitor_thread(), mwi_monitor_handler(), mwi_send_thread(), network_thread(), node_lookup(), odbc_obj_connect(), odbc_obj_disconnect(), oh323_alloc(), oh323_answer(), oh323_call(), oh323_destroy(), oh323_digit_begin(), oh323_digit_end(), oh323_fixup(), oh323_get_rtp_peer(), oh323_hangup(), oh323_indicate(), oh323_read(), oh323_request(), oh323_simulate_dtmf_end(), oh323_update_info(), oh323_write(), osp_create_provider(), osp_create_transaction(), osp_get_provider(), osp_unload(), parse_config(), parsing(), peer_destructor(), pgsql_log(), phone_request(), pri_dchannel(), pri_hangup_all(), pri_rel(), private_enum_init(), process_events(), process_message(), progress(), prune_gateways(), pthread_timer_open(), pvt_destructor(), queue_ringing_trunk(), radio_tune(), rcv_mac_addr(), realtime_destroy_handler(), realtime_handler(), realtime_ldap_base_ap(), realtime_multi_handler(), realtime_multi_pgsql(), realtime_pgsql(), realtime_store_handler(), realtime_update_handler(), receive_digit(), recordthread(), refresh_list(), register_verify(), registry_authrequest(), release_chan(), release_chan_early(), reload(), reload_agents(), reload_config(), reload_followme(), remote_hold(), require_pgsql(), restart_monitor(), retrans_pkt(), rpt_master(), rpt_tele_thread(), rtp_bridge_unlock(), run_devstate_collector(), run_station(), save_to_folder(), sched_context_destroy(), sched_thread(), scheduled_destroy(), send_client(), send_command_locked(), send_request(), send_retransmit(), set_config(), set_dtmf_payload(), set_eventmask(), set_local_capabilities(), set_peer_capabilities(), set_pvt_defaults(), setup_chanspy_ds(), setup_dahdi(), setup_rtp_connection(), signal_condition(), sip_reload(), skinny_get_rtp_peer(), skinny_hangup(), skinny_read(), skinny_req_parse(), skinny_write(), sla_check_reload(), 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(), socket_process_meta(), speech_background(), sqlite3_log(), sqlite_log(), ss7_linkset(), ss7_rel(), ss7_start_call(), ss_thread(), start_rtp(), statpost(), stop_poll_thread(), store_config(), store_pgsql(), submit_unscheduled_batch(), tds_load_module(), tds_log(), tds_unload_module(), timing_read(), tps_ping_handler(), tps_processing_function(), tps_taskprocessor_destroy(), tps_taskprocessor_pop(), transmit_response(), tune_write(), unistim_fixup(), unistim_hangup(), unistim_info(), unistim_new(), unistim_read(), unistim_register(), unistim_reload(), unistim_write(), unistimsock_read(), unload_module(), unlock_both(), unlock_msg_q(), unlock_read(), update_ldap(), update_pgsql(), update_registry(), verboser(), vm_execmain(), wakeup_sub(), and writefile().

01707 {
01708    return pthread_mutex_unlock(pmutex);
01709 }

static int ast_rwlock_destroy ( ast_rwlock_t prwlock  )  [inline, static]

Definition at line 1785 of file lock.h.

Referenced by __ast_internal_context_destroy(), ast_hashtab_destroy(), ast_hashtab_destroylock(), and ast_heap_destroy().

01786 {
01787    return pthread_rwlock_destroy(prwlock);
01788 }

static int ast_rwlock_init ( ast_rwlock_t prwlock  )  [inline, static]

Definition at line 1769 of file lock.h.

Referenced by ast_context_find_or_create(), ast_hashtab_create(), ast_hashtab_dup(), ast_hashtab_initlock(), and ast_heap_create().

01770 {
01771    int res;
01772    pthread_rwlockattr_t attr;
01773 
01774    pthread_rwlockattr_init(&attr);
01775 
01776 #ifdef HAVE_PTHREAD_RWLOCK_PREFER_WRITER_NP
01777    pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NP);
01778 #endif
01779 
01780    res = pthread_rwlock_init(prwlock, &attr);
01781    pthread_rwlockattr_destroy(&attr);
01782    return res;
01783 }

static int ast_rwlock_rdlock ( ast_rwlock_t prwlock  )  [inline, static]
static int ast_rwlock_timedrdlock ( ast_rwlock_t prwlock,
const struct timespec *  abs_timeout 
) [inline, static]

Definition at line 1800 of file lock.h.

References ast_tvnow(), and ast_tvsub().

01801 {
01802    int res;
01803 #ifdef HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK
01804    res = pthread_rwlock_timedrdlock(prwlock, abs_timeout);
01805 #else
01806    struct timeval _start = ast_tvnow(), _diff;
01807    for (;;) {
01808       if (!(res = pthread_rwlock_tryrdlock(prwlock))) {
01809          break;
01810       }
01811       _diff = ast_tvsub(ast_tvnow(), _start);
01812       if (_diff.tv_sec > abs_timeout->tv_sec || (_diff.tv_sec == abs_timeout->tv_sec && _diff.tv_usec * 1000 > abs_timeout->tv_nsec)) {
01813          break;
01814       }
01815       usleep(1);
01816    }
01817 #endif
01818    return res;
01819 }

static int ast_rwlock_timedwrlock ( ast_rwlock_t prwlock,
const struct timespec *  abs_timeout 
) [inline, static]

Definition at line 1831 of file lock.h.

References ast_tvnow(), and ast_tvsub().

01832 {
01833    int res;
01834 #ifdef HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK
01835    res = pthread_rwlock_timedwrlock(prwlock, abs_timeout);
01836 #else
01837    do {
01838       struct timeval _start = ast_tvnow(), _diff;
01839       for (;;) {
01840          if (!(res = pthread_rwlock_trywrlock(prwlock))) {
01841             break;
01842          }
01843          _diff = ast_tvsub(ast_tvnow(), _start);
01844          if (_diff.tv_sec > abs_timeout->tv_sec || (_diff.tv_sec == abs_timeout->tv_sec && _diff.tv_usec * 1000 > abs_timeout->tv_nsec)) {
01845             break;
01846          }
01847          usleep(1);
01848       }
01849    } while (0);
01850 #endif
01851    return res;
01852 }

static int ast_rwlock_tryrdlock ( ast_rwlock_t prwlock  )  [inline, static]

Definition at line 1821 of file lock.h.

01822 {
01823    return pthread_rwlock_tryrdlock(prwlock);
01824 }

static int ast_rwlock_trywrlock ( ast_rwlock_t prwlock  )  [inline, static]

Definition at line 1854 of file lock.h.

01855 {
01856    return pthread_rwlock_trywrlock(prwlock);
01857 }

static int ast_rwlock_unlock ( ast_rwlock_t prwlock  )  [inline, static]
static int ast_rwlock_wrlock ( ast_rwlock_t prwlock  )  [inline, static]

Generated on 3 Mar 2010 for Asterisk - the Open Source PBX by  doxygen 1.6.1