![]() |
Home page |
Mailing list |
Docs
Asterisk developer's documentation :: Codename Pineapple
lock.h File Reference
Definition in file lock.h.
#include <pthread.h>
#include <netdb.h>
#include <time.h>
#include <sys/param.h>
#include "asterisk/logger.h"
#include "asterisk/inline_api.h"
Include dependency graph for lock.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Defines | |
| #define | __AST_MUTEX_DEFINE(scope, mutex) scope ast_mutex_t mutex = AST_MUTEX_INIT_VALUE |
| #define | __AST_RWLOCK_DEFINE(scope, rwlock) |
| #define | __MTX_PROF(a) return pthread_mutex_lock((a)) |
| #define | ast_channel_lock(x) ast_mutex_lock(&x->lock) |
| #define | ast_channel_trylock(x) ast_mutex_trylock(&x->lock) |
| #define | ast_channel_unlock(x) ast_mutex_unlock(&x->lock) |
| #define | AST_MUTEX_DEFINE_STATIC(mutex) __AST_MUTEX_DEFINE(static, mutex) |
| #define | AST_MUTEX_INIT_VALUE ((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 |
| #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) |
| #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_MUTEX_INITIALIZER |
| #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_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) |
| AST_INLINE_API (int ast_atomic_fetchadd_int(volatile int *p, int v),{return ast_atomic_fetchadd_int_slow(p, v);}) AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p) | |
| 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. decrement *p by 1 and return true if the variable has reached 0. Useful e.g. to check if a refcount has reached 0. | |
| 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_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) |
|
|
|
|
|
|
|
|
Definition at line 59 of file lock.h. Referenced by ast_mutex_lock(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 88 of file lock.h. Referenced by ast_mutex_init(). |
|
|
|
|
|
|
Definition at line 75 of file lock.h. Referenced by __unload_module(), ast_dial_join(), ast_smdi_interface_destroy(), kill_monitor(), monitor_dial(), restart_monitor(), and unload_module(). |
|
|
|
|
|
Definition at line 614 of file lock.h. Referenced by connect_sphinx(), and gethostbyname_r(). |
|
|
Definition at line 606 of file lock.h. Referenced by ast_cond_broadcast(). |
|
|
Definition at line 604 of file lock.h. Referenced by ast_cond_destroy(). |
|
|
Definition at line 603 of file lock.h. Referenced by ast_cond_init(). |
|
|
Definition at line 605 of file lock.h. Referenced by ast_cond_signal(). |
|
|
|
|
|
Definition at line 608 of file lock.h. Referenced by ast_cond_timedwait(). |
|
|
Definition at line 607 of file lock.h. Referenced by ast_cond_wait(). |
|
|
Definition at line 617 of file lock.h. Referenced by ast_pthread_create_stack(), and misdn_tasks_init(). |
|
|
Definition at line 601 of file lock.h. Referenced by ast_mutex_destroy(), and dlcompat_cleanup(). |
|
|
Definition at line 600 of file lock.h. Referenced by ast_mutex_init(), and dlcompat_init_func(). |
|
|
|
|
|
Definition at line 597 of file lock.h. Referenced by dolock(). |
|
|
|
|
|
Definition at line 599 of file lock.h. Referenced by ast_mutex_trylock(). |
|
|
Definition at line 598 of file lock.h. Referenced by ast_mutex_unlock(), and dounlock(). |
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
Definition at line 939 of file utils.c. References ast_mutex_lock(), and ast_mutex_unlock(). 00940 { 00941 int ret; 00942 ast_mutex_lock(&fetchadd_m); 00943 ret = *p; 00944 *p += v; 00945 ast_mutex_unlock(&fetchadd_m); 00946 return ret; 00947 }
|
|
|
Definition at line 555 of file lock.h. References pthread_cond_broadcast. 00556 { 00557 return pthread_cond_broadcast(cond); 00558 }
|
|
|
Definition at line 560 of file lock.h. References pthread_cond_destroy. Referenced by ast_channel_spy_free(), do_reload(), find_idle_thread(), init_logger(), and thread_free(). 00561 { 00562 return pthread_cond_destroy(cond); 00563 }
|
|
||||||||||||
|
Definition at line 545 of file lock.h. References pthread_cond_init. Referenced by ast_channel_spy_add(), ast_device_state_engine_init(), do_reload(), find_idle_thread(), init_logger(), load_module(), and start_network_thread(). 00546 { 00547 return pthread_cond_init(cond, cond_attr); 00548 }
|
|
|
Definition at line 550 of file lock.h. References pthread_cond_signal. Referenced by __ast_device_state_changed_literal(), __unload_module(), ast_log(), ast_verbose(), close_logger(), queue_frame_to_spies(), signal_condition(), spy_detach(), and submit_unscheduled_batch(). 00551 { 00552 return pthread_cond_signal(cond); 00553 }
|
|
||||||||||||||||
|
Definition at line 570 of file lock.h. References pthread_cond_timedwait. Referenced by ast_channel_spy_trigger_wait(), do_cdr(), iax2_process_thread(), and sched_thread(). 00571 { 00572 return pthread_cond_timedwait(cond, t, abstime); 00573 }
|
|
||||||||||||
|
Definition at line 565 of file lock.h. References pthread_cond_wait. Referenced by do_devstate_changes(), and logger_thread(). 00566 { 00567 return pthread_cond_wait(cond, t); 00568 }
|
|
|
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. 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 528 of file lock.h. References pthread_mutex_destroy. Referenced by __login_exec(), __oh323_destroy(), agent_cleanup(), agent_hangup(), ast_channel_free(), ast_channel_spy_free(), ast_channel_whisper_stop(), ast_dnsmgr_release(), ast_odbc_request_obj(), ast_rtp_destroy(), ast_speech_destroy(), ast_speech_new(), build_gateway(), delete_devices(), destroy_session(), destroy_zt_pvt(), features_hangup(), find_idle_thread(), free_session(), local_alloc(), local_hangup(), local_queue_frame(), misdn_cfg_destroy(), misdn_jb_destroy(), read_agent_config(), release_chan(), sched_context_destroy(), sip_alloc(), thread_free(), timing_read(), and unload_module(). 00529 { 00530 return pthread_mutex_destroy(pmutex); 00531 }
|
|
|
Definition at line 511 of file lock.h. References AST_MUTEX_KIND, and pthread_mutex_init. Referenced by accept_thread(), add_agent(), ast_channel_whisper_start(), ast_dnsmgr_get(), ast_odbc_request_obj(), ast_rtp_new_init(), ast_speech_new(), build_device(), build_gateway(), chandup(), features_alloc(), find_idle_thread(), find_tpeer(), gtalk_alloc(), jingle_alloc(), load_module(), local_alloc(), misdn_cfg_init(), misdn_jb_init(), mkintf(), oh323_alloc(), read_config(), sched_context_create(), session_do(), sip_alloc(), sipnet_lock_init(), skinny_new(), and start_network_thread(). 00512 { 00513 pthread_mutexattr_t attr; 00514 00515 pthread_mutexattr_init(&attr); 00516 pthread_mutexattr_settype(&attr, AST_MUTEX_KIND); 00517 00518 return pthread_mutex_init(pmutex, &attr); 00519 }
|
|
|
|
Definition at line 538 of file lock.h. References pthread_mutex_trylock. Referenced by agent_new(), ast_module_reload(), cache_get_callno_locked(), check_bridge(), dialoglist_lock(), do_monitor(), grab_owner(), iax2_destroy(), iax2_queue_frame(), local_queue_frame(), lock_both(), mgcp_queue_frame(), mgcp_queue_hangup(), network_thread(), refresh_list(), socket_process(), unload_module(), wakeup_sub(), zap_queue_frame(), zt_bridge(), zt_handle_event(), and zt_unlink(). 00539 { 00540 return pthread_mutex_trylock(pmutex); 00541 }
|
|
|
|
Definition at line 635 of file lock.h.
|
|
|
Definition at line 622 of file lock.h. 00623 { 00624 pthread_rwlockattr_t attr; 00625 00626 pthread_rwlockattr_init(&attr); 00627 00628 #ifdef HAVE_PTHREAD_RWLOCK_PREFER_WRITER_NP 00629 pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NP); 00630 #endif 00631 00632 return pthread_rwlock_init(prwlock, &attr); 00633 }
|
|
|
Definition at line 645 of file lock.h. Referenced by ast_add_extension2(), complete_show_mancmd(), handle_show_globals(), handle_showmancmds(), pbx_builtin_getvar_helper(), pbx_retrieve_variable(), and process_message().
|
|
|
Definition at line 650 of file lock.h.
|
|
|
Definition at line 660 of file lock.h.
|
|
|
Definition at line 640 of file lock.h. Referenced by ast_add_extension2(), ast_manager_register_struct(), handle_show_globals(), handle_showmancmds(), pbx_builtin_clear_globals(), pbx_builtin_getvar_helper(), pbx_builtin_pushvar_helper(), pbx_builtin_setvar_helper(), and pbx_retrieve_variable().
|
|
|
Definition at line 655 of file lock.h. Referenced by ast_manager_register_struct(), ast_manager_unregister(), pbx_builtin_clear_globals(), pbx_builtin_pushvar_helper(), and pbx_builtin_setvar_helper().
|