Haka
Macros | Typedefs | Enumerations | Functions
Thread

Macros

#define THREAD_CANCELED   PTHREAD_CANCELED
 

Typedefs

typedef pthread_t thread_t
 

Enumerations

Functions

int thread_get_packet_capture_cpu_count ()
 
void thread_set_packet_capture_cpu_count (int count)
 
int thread_get_cpu_count ()
 
bool thread_create (thread_t *thread, void *(*main)(void *), void *param)
 
thread_t thread_current ()
 
bool thread_join (thread_t thread, void **ret)
 
bool thread_cancel (thread_t thread)
 
int thread_getid ()
 
void thread_setid (int id)
 
bool thread_sigmask (int how, sigset_t *set, sigset_t *oldset)
 
bool thread_signal (thread_t thread, int sig)
 
bool thread_setcancelstate (bool enable)
 
bool thread_setcanceltype (enum thread_cancel_t type)
 
void thread_testcancel ()
 
void thread_protect (void(*run)(void *), void *runarg, void(*finish)(void *), void *finisharg)
 
thread_t thread_main ()
 
thread_t thread_self ()
 
bool thread_equal (thread_t a, thread_t b)
 
bool thread_kill (thread_t thread, int sig)
 

Detailed Description

Thread functions

Macro Definition Documentation

#define THREAD_CANCELED   PTHREAD_CANCELED

Thread return value when canceled.

Typedef Documentation

typedef pthread_t thread_t

Opaque thread type.

Enumeration Type Documentation

Thread cancel mode.

Enumerator
THREAD_CANCEL_DEFERRED 

Deferred mode.

THREAD_CANCEL_ASYNCHRONOUS 

Asynchronous mode.

Function Documentation

bool thread_cancel ( thread_t  thread)

Cancel a running thread.

bool thread_create ( thread_t thread,
void *(*)(void *)  main,
void *  param 
)

Start a new thread.

thread_t thread_current ( )

Get the current thread.

bool thread_equal ( thread_t  a,
thread_t  b 
)

Check if two threads are the same.

int thread_get_cpu_count ( )

Get the number of CPUs.

int thread_get_packet_capture_cpu_count ( )

Get the number of thread to be used by the application for packet capture.

int thread_getid ( )

Get current thread id.

bool thread_join ( thread_t  thread,
void **  ret 
)

Join a thread.

bool thread_kill ( thread_t  thread,
int  sig 
)

Raise a signal on the given thread.

thread_t thread_main ( )

Get the main thread handle.

void thread_protect ( void(*)(void *)  run,
void *  runarg,
void(*)(void *)  finish,
void *  finisharg 
)

Run a function in protected mode. If a cancel is raised, then a cleanup function is called before leaving the thread.

thread_t thread_self ( )

Get the current thread.

void thread_set_packet_capture_cpu_count ( int  count)

Set the number of thread to be used by the application for packet capture.

Parameters
countNumber of thread to use for capture.
bool thread_setcancelstate ( bool  enable)

Change thread support for cancel.

bool thread_setcanceltype ( enum thread_cancel_t  type)

Change thread cancel mode.

void thread_setid ( int  id)

Set current thread id.

Parameters
idNew thread identifier.
bool thread_sigmask ( int  how,
sigset_t *  set,
sigset_t *  oldset 
)

Set signal mask on a thread.

bool thread_signal ( thread_t  thread,
int  sig 
)

Send a signal to the given thread.

void thread_testcancel ( )

Check for cancel.