Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

Threads and Process Functions
[Brought To You By APR]


Typedefs

typedef apr_thread_t switch_thread_t
typedef apr_threadattr_t switch_threadattr_t
typedef void *SWITCH_THREAD_FUNC * switch_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_increase (switch_threadattr_t *attr)
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)


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*);

typedef struct apr_thread_t switch_thread_t
 

Opaque Thread structure.

typedef struct apr_threadattr_t switch_threadattr_t
 

Opaque Thread attributes structure.


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_thread The newly created thread handle.
attr The threadattr to use to determine how to create the thread
func The function to start the new thread in
data Any data to be passed to the starting function
cont The pool to use
00545 {
00546         return apr_thread_create(new_thread, attr, func, data, cont);
00547 }

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_attr The newly created threadattr.
pool The pool to use
00503 {
00504         return apr_threadattr_create(new_attr, pool);
00505 }

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:
attr The threadattr to affect
on Non-zero if detached threads should be created.
00508 {
00509         return apr_threadattr_detach_set(attr, on);
00510 }

switch_status_t switch_threadattr_priority_increase switch_threadattr_t attr  ) 
 

00525 {
00526         int stat = 0;
00527 #ifndef WIN32
00528         struct sched_param param;
00529         struct apr_threadattr_t *myattr = attr;
00530 
00531         pthread_attr_getschedparam(&myattr->attr, &param);
00532         param.sched_priority = 50;
00533         stat = pthread_attr_setschedparam(&myattr->attr, &param);
00534 
00535         if (stat == 0) {
00536                 return SWITCH_STATUS_SUCCESS;
00537         }
00538 #endif
00539         return stat;
00540 }

switch_status_t switch_threadattr_stacksize_set switch_threadattr_t attr,
switch_size_t  stacksize
 

00513 {
00514         return apr_threadattr_stacksize_set(attr, stacksize);
00515 }


Generated on Fri Oct 10 11:24:23 2008 for FreeSWITCH by  doxygen 1.3.9.1