Collaboration diagram for Thread Mutex Routines:
Defines | |
| #define | SWITCH_MUTEX_DEFAULT 0x0 |
| #define | SWITCH_MUTEX_NESTED 0x1 |
| #define | SWITCH_MUTEX_UNNESTED 0x2 |
Typedefs | |
| typedef apr_thread_mutex_t | switch_mutex_t |
Functions | |
| switch_status_t | switch_mutex_init (switch_mutex_t **lock, unsigned int flags, switch_memory_pool_t *pool) |
| switch_status_t | switch_mutex_destroy (switch_mutex_t *lock) |
| switch_status_t | switch_mutex_lock (switch_mutex_t *lock) |
| switch_status_t | switch_mutex_unlock (switch_mutex_t *lock) |
| switch_status_t | switch_mutex_trylock (switch_mutex_t *lock) |
| #define SWITCH_MUTEX_DEFAULT 0x0 |
Lock Flags platform-optimal lock behavior
Definition at line 366 of file switch_apr.h.
| #define SWITCH_MUTEX_NESTED 0x1 |
enable nested (recursive) locks
Definition at line 367 of file switch_apr.h.
Referenced by create_handle(), inband_dtmf_generate_callback(), preprocess_callback(), speech_thread(), switch_channel_alloc(), switch_console_init(), switch_core_codec_copy(), switch_core_codec_init_with_bitrate(), switch_core_init(), switch_core_media_bug_add(), switch_core_memory_init(), switch_core_port_allocator_new(), switch_core_session_request_uuid(), switch_core_sqldb_start(), switch_event_init(), switch_ivr_activate_unicast(), switch_ivr_dmachine_create(), switch_ivr_eavesdrop_session(), switch_ivr_enterprise_originate(), switch_loadable_module_init(), switch_log_init(), SWITCH_MODULE_LOAD_FUNCTION(), SWITCH_MODULE_RUNTIME_FUNCTION(), switch_rtp_create(), switch_rtp_init(), switch_scheduler_task_thread_start(), switch_system_thread(), switch_xml_init(), and timer_init().
| #define SWITCH_MUTEX_UNNESTED 0x2 |
disable nested locks
Definition at line 368 of file switch_apr.h.
| typedef struct apr_thread_mutex_t switch_mutex_t |
Opaque thread-local mutex structure
Definition at line 363 of file switch_apr.h.
| switch_status_t switch_mutex_destroy | ( | switch_mutex_t * | lock | ) |
Destroy the mutex and free the memory associated with the lock.
| lock | the mutex to destroy. |
Definition at line 297 of file switch_apr.c.
| switch_status_t switch_mutex_init | ( | switch_mutex_t ** | lock, | |
| unsigned int | flags, | |||
| switch_memory_pool_t * | pool | |||
| ) |
Create and initialize a mutex that can be used to synchronize threads.
| lock | the memory address where the newly created mutex will be stored. | |
| flags | Or'ed value of:
SWITCH_THREAD_MUTEX_DEFAULT platform-optimal lock behavior.
SWITCH_THREAD_MUTEX_NESTED enable nested (recursive) locks.
SWITCH_THREAD_MUTEX_UNNESTED disable nested locks (non-recursive).
| |
| pool | the pool from which to allocate the mutex. |
Definition at line 292 of file switch_apr.c.
Referenced by create_handle(), inband_dtmf_generate_callback(), preprocess_callback(), speech_thread(), switch_channel_alloc(), switch_console_init(), switch_core_codec_copy(), switch_core_codec_init_with_bitrate(), switch_core_init(), switch_core_media_bug_add(), switch_core_memory_init(), switch_core_port_allocator_new(), switch_core_session_request_uuid(), switch_core_sqldb_start(), switch_event_init(), switch_ivr_activate_unicast(), switch_ivr_dmachine_create(), switch_ivr_eavesdrop_session(), switch_ivr_enterprise_originate(), switch_loadable_module_init(), switch_log_init(), SWITCH_MODULE_LOAD_FUNCTION(), SWITCH_MODULE_RUNTIME_FUNCTION(), switch_rtp_create(), switch_rtp_init(), switch_scheduler_task_thread_start(), switch_system_thread(), switch_xml_init(), and timer_init().
00293 { 00294 return apr_thread_mutex_create(lock, flags, pool); 00295 }
| switch_status_t switch_mutex_lock | ( | switch_mutex_t * | lock | ) |
Acquire the lock for the given mutex. If the mutex is already locked, the current thread will be put to sleep until the lock becomes available.
| lock | the mutex on which to acquire the lock. |
Definition at line 302 of file switch_apr.c.
Referenced by add_handle(), chat_queue_message(), chat_thread_start(), del_handle(), do_chat_send(), early_thread_run(), enterprise_originate_thread(), event_handler(), generate_on_dtmf(), get_handle(), inband_dtmf_generate_callback(), log_thread(), pool_thread(), speech_callback(), speech_thread(), sql_close(), switch_buffer_lock(), switch_buffer_trylock(), switch_cache_db_execute_sql(), switch_cache_db_execute_sql2str(), switch_cache_db_execute_sql_callback(), switch_cache_db_execute_sql_real(), switch_cache_db_persistant_execute(), switch_cache_db_persistant_execute_trans(), switch_cache_db_release_db_handle(), switch_cache_db_status(), switch_cache_db_test_reactive(), switch_channel_add_state_handler(), switch_channel_add_variable_var_check(), switch_channel_caller_extension_masquerade(), switch_channel_clear_app_flag_key(), switch_channel_clear_cap(), switch_channel_clear_flag(), switch_channel_clear_flag_recursive(), switch_channel_clear_private_flag(), switch_channel_clear_state_flag(), switch_channel_clear_state_handler(), switch_channel_dequeue_dtmf(), switch_channel_event_set_basic_data(), switch_channel_event_set_data(), switch_channel_event_set_extended_data(), switch_channel_flip_cid(), switch_channel_flush_dtmf(), switch_channel_get_caller_extension(), switch_channel_get_caller_profile(), switch_channel_get_cap_string(), switch_channel_get_flag_string(), switch_channel_get_originatee_caller_profile(), switch_channel_get_origination_caller_profile(), switch_channel_get_originator_caller_profile(), switch_channel_get_queued_extension(), switch_channel_get_scope_variables(), switch_channel_get_state_handler(), switch_channel_get_timetable(), switch_channel_get_variable_dup(), switch_channel_get_variables(), switch_channel_has_dtmf(), switch_channel_pass_callee_id(), switch_channel_perform_hangup(), switch_channel_perform_mark_answered(), switch_channel_perform_mark_pre_answered(), switch_channel_perform_mark_ring_ready_value(), switch_channel_perform_set_running_state(), switch_channel_perform_set_state(), switch_channel_queue_dtmf(), switch_channel_set_app_flag_key(), switch_channel_set_bridge_time(), switch_channel_set_caller_extension(), switch_channel_set_caller_profile(), switch_channel_set_cap_value(), switch_channel_set_flag_recursive(), switch_channel_set_flag_value(), switch_channel_set_hangup_time(), switch_channel_set_hunt_caller_profile(), switch_channel_set_originatee_caller_profile(), switch_channel_set_origination_caller_profile(), switch_channel_set_originator_caller_profile(), switch_channel_set_private_flag(), switch_channel_set_profile_var(), switch_channel_set_scope_variables(), switch_channel_set_state_flag(), switch_channel_set_timestamps(), switch_channel_set_variable_name_printf(), switch_channel_set_variable_printf(), switch_channel_set_variable_var_check(), switch_channel_sort_cid(), switch_channel_test_app_flag_key(), switch_channel_test_flag(), switch_channel_transfer_to_extension(), switch_channel_uninit(), switch_channel_variable_first(), switch_check_network_list_ip_token(), switch_cond_next(), switch_cond_yield(), switch_console_add_complete_func(), switch_console_del_complete_func(), switch_console_run_complete_func(), switch_core_add_state_handler(), switch_core_codec_decode(), switch_core_codec_destroy(), switch_core_codec_encode(), switch_core_dump_variables(), switch_core_hash_delete_locked(), switch_core_hash_find_locked(), switch_core_hash_insert_locked(), switch_core_media_bug_flush(), switch_core_media_bug_inuse(), switch_core_media_bug_read(), switch_core_memory_reclaim(), switch_core_perform_alloc(), switch_core_perform_destroy_memory_pool(), switch_core_perform_new_memory_pool(), switch_core_perform_permanent_alloc(), switch_core_perform_permanent_strdup(), switch_core_perform_session_alloc(), switch_core_perform_session_strdup(), switch_core_perform_strdup(), switch_core_port_allocator_free_port(), switch_core_port_allocator_request_port(), switch_core_remove_state_handler(), switch_core_service_thread(), switch_core_session_ctl(), switch_core_session_event_send(), switch_core_session_force_locate(), switch_core_session_hupall(), switch_core_session_hupall_endpoint(), switch_core_session_hupall_matching_var(), switch_core_session_locate(), switch_core_session_lock_codec_read(), switch_core_session_lock_codec_write(), switch_core_session_message_send(), switch_core_session_perform_destroy(), switch_core_session_read_frame(), switch_core_session_request_uuid(), switch_core_session_reset(), switch_core_session_run(), switch_core_session_set_read_codec(), switch_core_session_set_real_read_codec(), switch_core_session_set_uuid(), switch_core_session_set_write_codec(), switch_core_session_sync_clock(), switch_core_session_thread_launch(), switch_core_session_unset_read_codec(), switch_core_session_unset_write_codec(), switch_core_session_write_frame(), switch_core_sql_thread(), switch_core_vsprintf(), switch_event_bind_removable(), switch_event_dispatch_thread(), switch_event_init(), switch_event_prep_for_delivery_detailed(), switch_event_shutdown(), switch_event_thread(), switch_event_unbind(), switch_event_unbind_callback(), switch_ivr_dmachine_feed(), switch_ivr_dmachine_ping(), switch_ivr_enterprise_originate(), switch_ivr_preprocess_session(), switch_load_network_lists(), switch_loadable_module_enumerate_loaded(), switch_loadable_module_exists(), switch_loadable_module_get_codec_interface(), switch_loadable_module_get_codecs(), switch_loadable_module_get_codecs_sorted(), switch_loadable_module_get_endpoint_interface(), switch_loadable_module_process(), switch_loadable_module_runtime(), switch_loadable_module_unload_module(), switch_loadable_module_unprocess(), switch_log_bind_logger(), switch_log_unbind_logger(), SWITCH_MODULE_RUNTIME_FUNCTION(), SWITCH_MODULE_SHUTDOWN_FUNCTION(), switch_rtp_break(), switch_rtp_dequeue_dtmf(), switch_rtp_destroy(), switch_rtp_has_dtmf(), switch_rtp_kill_socket(), switch_rtp_new(), switch_rtp_ready(), switch_rtp_release_port(), switch_rtp_request_port(), switch_rtp_set_end_port(), switch_rtp_set_remote_address(), switch_rtp_set_start_port(), switch_rtp_shutdown(), switch_rtp_zerocopy_read_frame(), switch_scheduler_add_task(), switch_scheduler_del_task_group(), switch_scheduler_del_task_id(), switch_system_thread(), switch_uuid_get(), switch_xml_clear_user_cache(), switch_xml_destroy(), switch_xml_free(), switch_xml_locate_user_cache(), switch_xml_open_root(), switch_xml_parse_file(), switch_xml_root(), switch_xml_set_open_root_function(), switch_xml_set_root(), switch_xml_toxml(), switch_xml_user_cache(), system_thread(), task_thread_loop(), timer_destroy(), timer_init(), and timer_next().
| switch_status_t switch_mutex_trylock | ( | switch_mutex_t * | lock | ) |
Attempt to acquire the lock for the given mutex. If the mutex has already been acquired, the call returns immediately with APR_EBUSY. Note: it is important that the APR_STATUS_IS_EBUSY(s) macro be used to determine if the return value was APR_EBUSY, for portability reasons.
| lock | the mutex on which to attempt the lock acquiring. |
Definition at line 312 of file switch_apr.c.
Referenced by get_handle(), sql_close(), switch_cache_db_status(), switch_core_session_read_frame(), switch_core_session_wake_session_thread(), switch_core_session_write_frame(), SWITCH_MODULE_RUNTIME_FUNCTION(), and wake_thread().
| switch_status_t switch_mutex_unlock | ( | switch_mutex_t * | lock | ) |
Release the lock for the given mutex.
| lock | the mutex from which to release the lock. |
Definition at line 307 of file switch_apr.c.
Referenced by add_handle(), chat_queue_message(), del_handle(), do_chat_send(), early_thread_run(), enterprise_originate_thread(), event_handler(), generate_on_dtmf(), get_handle(), inband_dtmf_generate_callback(), log_thread(), pool_thread(), speech_callback(), speech_thread(), sql_close(), switch_buffer_unlock(), switch_cache_db_execute_sql(), switch_cache_db_execute_sql2str(), switch_cache_db_execute_sql_callback(), switch_cache_db_execute_sql_real(), switch_cache_db_persistant_execute(), switch_cache_db_persistant_execute_trans(), switch_cache_db_release_db_handle(), switch_cache_db_status(), switch_cache_db_test_reactive(), switch_channel_add_variable_var_check(), switch_channel_clear_app_flag_key(), switch_channel_clear_cap(), switch_channel_clear_flag(), switch_channel_clear_flag_recursive(), switch_channel_clear_private_flag(), switch_channel_clear_state_flag(), switch_channel_dequeue_dtmf(), switch_channel_event_set_basic_data(), switch_channel_event_set_data(), switch_channel_event_set_extended_data(), switch_channel_flip_cid(), switch_channel_flush_dtmf(), switch_channel_get_caller_extension(), switch_channel_get_caller_profile(), switch_channel_get_originatee_caller_profile(), switch_channel_get_origination_caller_profile(), switch_channel_get_originator_caller_profile(), switch_channel_get_queued_extension(), switch_channel_get_scope_variables(), switch_channel_get_state_handler(), switch_channel_get_timetable(), switch_channel_get_variable_dup(), switch_channel_get_variables(), switch_channel_has_dtmf(), switch_channel_pass_callee_id(), switch_channel_perform_hangup(), switch_channel_perform_mark_answered(), switch_channel_perform_mark_pre_answered(), switch_channel_perform_mark_ring_ready_value(), switch_channel_perform_set_state(), switch_channel_queue_dtmf(), switch_channel_set_app_flag_key(), switch_channel_set_bridge_time(), switch_channel_set_caller_extension(), switch_channel_set_caller_profile(), switch_channel_set_cap_value(), switch_channel_set_flag_recursive(), switch_channel_set_flag_value(), switch_channel_set_hangup_time(), switch_channel_set_hunt_caller_profile(), switch_channel_set_originatee_caller_profile(), switch_channel_set_origination_caller_profile(), switch_channel_set_originator_caller_profile(), switch_channel_set_private_flag(), switch_channel_set_profile_var(), switch_channel_set_scope_variables(), switch_channel_set_state_flag(), switch_channel_set_timestamps(), switch_channel_set_variable_name_printf(), switch_channel_set_variable_printf(), switch_channel_set_variable_var_check(), switch_channel_sort_cid(), switch_channel_test_app_flag_key(), switch_channel_test_flag(), switch_channel_transfer_to_extension(), switch_channel_uninit(), switch_channel_variable_first(), switch_channel_variable_last(), switch_cond_next(), switch_cond_yield(), switch_console_add_complete_func(), switch_console_del_complete_func(), switch_console_run_complete_func(), switch_core_add_state_handler(), switch_core_codec_decode(), switch_core_codec_destroy(), switch_core_codec_encode(), switch_core_dump_variables(), switch_core_hash_delete_locked(), switch_core_hash_find_locked(), switch_core_hash_insert_locked(), switch_core_media_bug_flush(), switch_core_media_bug_inuse(), switch_core_media_bug_read(), switch_core_memory_reclaim(), switch_core_perform_alloc(), switch_core_perform_destroy_memory_pool(), switch_core_perform_new_memory_pool(), switch_core_perform_permanent_alloc(), switch_core_perform_permanent_strdup(), switch_core_perform_session_alloc(), switch_core_perform_session_strdup(), switch_core_perform_strdup(), switch_core_port_allocator_free_port(), switch_core_port_allocator_request_port(), switch_core_remove_state_handler(), switch_core_service_thread(), switch_core_session_ctl(), switch_core_session_event_send(), switch_core_session_force_locate(), switch_core_session_hupall(), switch_core_session_hupall_endpoint(), switch_core_session_hupall_matching_var(), switch_core_session_locate(), switch_core_session_message_send(), switch_core_session_perform_destroy(), switch_core_session_read_frame(), switch_core_session_request_uuid(), switch_core_session_reset(), switch_core_session_run(), switch_core_session_set_read_codec(), switch_core_session_set_real_read_codec(), switch_core_session_set_uuid(), switch_core_session_set_write_codec(), switch_core_session_sync_clock(), switch_core_session_thread_launch(), switch_core_session_unlock_codec_read(), switch_core_session_unlock_codec_write(), switch_core_session_unset_read_codec(), switch_core_session_unset_write_codec(), switch_core_session_wake_session_thread(), switch_core_session_write_frame(), switch_core_sql_thread(), switch_core_vsprintf(), switch_event_bind_removable(), switch_event_dispatch_thread(), switch_event_init(), switch_event_prep_for_delivery_detailed(), switch_event_shutdown(), switch_event_thread(), switch_event_unbind(), switch_ivr_dmachine_feed(), switch_ivr_dmachine_ping(), switch_ivr_enterprise_originate(), switch_ivr_preprocess_session(), switch_load_network_lists(), switch_loadable_module_enumerate_loaded(), switch_loadable_module_exists(), switch_loadable_module_get_codec_interface(), switch_loadable_module_get_codecs(), switch_loadable_module_get_codecs_sorted(), switch_loadable_module_get_endpoint_interface(), switch_loadable_module_process(), switch_loadable_module_runtime(), switch_loadable_module_unload_module(), switch_loadable_module_unprocess(), switch_log_bind_logger(), SWITCH_MODULE_RUNTIME_FUNCTION(), SWITCH_MODULE_SHUTDOWN_FUNCTION(), switch_rtp_break(), switch_rtp_dequeue_dtmf(), switch_rtp_destroy(), switch_rtp_has_dtmf(), switch_rtp_kill_socket(), switch_rtp_new(), switch_rtp_ready(), switch_rtp_release_port(), switch_rtp_request_port(), switch_rtp_set_end_port(), switch_rtp_set_remote_address(), switch_rtp_set_start_port(), switch_rtp_shutdown(), switch_rtp_zerocopy_read_frame(), switch_scheduler_add_task(), switch_scheduler_del_task_group(), switch_scheduler_del_task_id(), switch_system_thread(), switch_uuid_get(), switch_xml_clear_user_cache(), switch_xml_destroy(), switch_xml_free(), switch_xml_locate_user_cache(), switch_xml_open_root(), switch_xml_parse_file(), switch_xml_root(), switch_xml_set_open_root_function(), switch_xml_set_root(), switch_xml_toxml(), switch_xml_user_cache(), system_thread(), task_thread_loop(), timer_destroy(), timer_init(), timer_next(), and wake_thread().
1.4.7