FreeSWITCH API Documentation  1.7.0
Typedefs | Functions
Threads and Process Functions
+ Collaboration diagram for Threads and Process Functions:

Typedefs

typedef struct apr_thread_t switch_thread_t
 
typedef struct apr_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

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.

typedef struct apr_thread_t switch_thread_t

Opaque Thread structure.

Definition at line 941 of file switch_apr.h.

Opaque Thread attributes structure.

Definition at line 944 of file switch_apr.h.

Function Documentation

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 675 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(), record_callback(), speech_callback(), 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_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_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().

677 {
678  switch_core_memory_pool_set_data(cont, "_in_thread", TT_KEY);
679  return apr_thread_create(new_thread, attr, func, data, cont);
680 }
static char TT_KEY[]
Definition: switch_apr.c:673
void switch_core_memory_pool_set_data(switch_memory_pool_t *pool, const char *key, void *data)
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 
)

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 655 of file switch_apr.c.

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

656 {
657  return apr_threadattr_detach_set(attr, on);
658 }
switch_status_t switch_threadattr_priority_set ( switch_threadattr_t attr,
switch_thread_priority_t  priority 
)
switch_status_t switch_threadattr_stacksize_set ( switch_threadattr_t attr,
switch_size_t  stacksize 
)