RTS API Documentation  1.10.11
Typedefs | Functions
Threads and Process Functions
+ Collaboration diagram for Threads and Process Functions:

Typedefs

typedef struct fspr_thread_t switch_thread_t
 
typedef struct fspr_threadattr_t switch_threadattr_t
 
typedef void *(SWITCH_THREAD_FUNCswitch_thread_start_t) (switch_thread_t *, void *)
 

Functions

switch_status_t switch_threadattr_stacksize_set (switch_threadattr_t *attr, switch_size_t stacksize)
 
switch_status_t switch_threadattr_priority_set (switch_threadattr_t *attr, switch_thread_priority_t priority)
 
switch_status_t switch_threadattr_create (switch_threadattr_t **new_attr, switch_memory_pool_t *pool)
 
switch_status_t switch_threadattr_detach_set (switch_threadattr_t *attr, int32_t on)
 
switch_status_t switch_thread_create (switch_thread_t **new_thread, switch_threadattr_t *attr, switch_thread_start_t func, void *data, switch_memory_pool_t *cont)
 

Detailed Description

Typedef Documentation

◆ switch_thread_start_t

typedef void*(SWITCH_THREAD_FUNC * switch_thread_start_t) (switch_thread_t *, void *)

The prototype for any APR thread worker functions. typedef void *(SWITCH_THREAD_FUNC switch_thread_start_t)(switch_thread_t, void*);

Definition at line 950 of file switch_apr.h.

◆ switch_thread_t

typedef struct fspr_thread_t switch_thread_t

Opaque Thread structure.

Definition at line 941 of file switch_apr.h.

◆ switch_threadattr_t

Opaque Thread attributes structure.

Definition at line 944 of file switch_apr.h.

Function Documentation

◆ switch_thread_create()

switch_status_t switch_thread_create ( switch_thread_t **  new_thread,
switch_threadattr_t attr,
switch_thread_start_t  func,
void *  data,
switch_memory_pool_t cont 
)

Create a new thread of execution

Parameters
new_threadThe newly created thread handle.
attrThe threadattr to use to determine how to create the thread
funcThe function to start the new thread in
dataAny data to be passed to the starting function
contThe pool to use

Definition at line 698 of file switch_apr.c.

References switch_core_memory_pool_set_data(), and TT_KEY.

Referenced by chat_thread_start(), check_queue(), launch_collect_thread(), msrp_listener(), record_callback(), speech_callback(), switch_console_save_history(), switch_core_launch_thread(), switch_core_media_bug_add(), switch_core_media_set_video_file(), switch_core_memory_init(), switch_core_session_launch_thread(), switch_core_session_start_audio_write_thread(), switch_core_session_start_text_thread(), switch_core_session_start_video_thread(), switch_core_session_thread_launch(), switch_core_sqldb_start(), switch_event_launch_dispatch_threads(), switch_ivr_broadcast_in_thread(), switch_ivr_enterprise_originate(), switch_ivr_originate(), switch_log_init(), switch_msrp_init(), switch_msrp_start_client(), switch_nat_thread_start(), switch_scheduler_task_thread_start(), switch_sql_queue_manager_start(), switch_system_thread(), switch_xml_free_in_thread(), task_thread_loop(), and unicast_thread_launch().

700 {
701  switch_core_memory_pool_set_data(cont, "_in_thread", TT_KEY);
702  return fspr_thread_create(new_thread, attr, func, data, cont);
703 }
static char TT_KEY[]
Definition: switch_apr.c:696
void switch_core_memory_pool_set_data(switch_memory_pool_t *pool, const char *key, void *data)

◆ switch_threadattr_create()

switch_status_t switch_threadattr_create ( switch_threadattr_t **  new_attr,
switch_memory_pool_t pool 
)

Create and initialize a new threadattr variable

Parameters
new_attrThe newly created threadattr.
poolThe pool to use

Definition at line 665 of file switch_apr.c.

References SWITCH_PRI_LOW, and SWITCH_STATUS_SUCCESS.

Referenced by chat_thread_start(), check_queue(), launch_collect_thread(), msrp_listener(), record_callback(), speech_callback(), switch_console_save_history(), switch_core_launch_thread(), switch_core_media_bug_add(), switch_core_media_set_video_file(), switch_core_memory_init(), switch_core_session_launch_thread(), switch_core_session_start_audio_write_thread(), switch_core_session_start_text_thread(), switch_core_session_start_video_thread(), switch_core_session_thread_launch(), switch_core_sqldb_start(), switch_event_launch_dispatch_threads(), switch_ivr_broadcast_in_thread(), switch_ivr_enterprise_originate(), switch_ivr_originate(), switch_log_init(), switch_msrp_init(), switch_msrp_start_client(), switch_nat_thread_start(), switch_scheduler_task_thread_start(), switch_sql_queue_manager_start(), switch_system_thread(), switch_xml_free_in_thread(), task_thread_loop(), and unicast_thread_launch().

666 {
667  switch_status_t status;
668 
669  if ((status = fspr_threadattr_create(new_attr, pool)) == SWITCH_STATUS_SUCCESS) {
670 
671  (*new_attr)->priority = SWITCH_PRI_LOW;
672 
673  }
674 
675  return status;
676 }
switch_memory_pool_t * pool
switch_status_t
Common return values.

◆ switch_threadattr_detach_set()

switch_status_t switch_threadattr_detach_set ( switch_threadattr_t attr,
int32_t  on 
)

Set if newly created threads should be created in detached state.

Parameters
attrThe threadattr to affect
onNon-zero if detached threads should be created.

Definition at line 678 of file switch_apr.c.

Referenced by check_queue(), launch_collect_thread(), msrp_listener(), switch_console_save_history(), switch_core_session_launch_thread(), switch_core_session_thread_launch(), switch_ivr_broadcast_in_thread(), switch_msrp_start_client(), switch_system_thread(), switch_xml_free_in_thread(), and task_thread_loop().

679 {
680  return fspr_threadattr_detach_set(attr, on);
681 }

◆ switch_threadattr_priority_set()

switch_status_t switch_threadattr_priority_set ( switch_threadattr_t attr,
switch_thread_priority_t  priority 
)

◆ switch_threadattr_stacksize_set()

switch_status_t switch_threadattr_stacksize_set ( switch_threadattr_t attr,
switch_size_t  stacksize 
)