gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
Thread Class Reference

#include <Thread.H>

Inheritance diagram for Thread:
[legend]

Public Member Functions

 Thread (void)
 
virtual ~Thread (void)
 
void * stop (void)
 
int run (void *(*start_routine)(void *), void *data, int priority=0)
 
int setPriority (pthread_attr_t *attributes, int priority)
 
int getPriority ()
 
void * meetThread (void)
 
void exit (void *retVal)
 
bool running ()
 

Private Attributes

pthread_t thread
 The thread structure. More...
 

Detailed Description

Class to spawn a thread and meet an exited thread. Can use GLib threads if you define USE_GLIB_THREADS, uses pthread otherwise. The main difference between using pthread and glib threads is discussed in the meetThread method.

Examples:
ThreadTest.C.

Definition at line 63 of file Thread.H.

Constructor & Destructor Documentation

◆ Thread()

Thread::Thread ( void  )
inline

Constructor

Definition at line 75 of file Thread.H.

◆ ~Thread()

virtual Thread::~Thread ( void  )
inlinevirtual

Destructor

Definition at line 86 of file Thread.H.

Member Function Documentation

◆ exit()

void Thread::exit ( void *  retVal)
inline

Called to exit the thread passes retVal to the one who calls meetThread

Parameters
retValThe pointer to pass to the meetThread caller

Definition at line 219 of file Thread.H.

◆ getPriority()

int Thread::getPriority ( )
inline

Definition at line 180 of file Thread.H.

Here is the call graph for this function:

◆ meetThread()

void* Thread::meetThread ( void  )
inline

Wait for the thread to end

Returns
If using USE_GLIB_THREADS then NULL, if using pthreads, then the argument passed to Thread::exit when called by the exiting thread.

Definition at line 197 of file Thread.H.

◆ run()

int Thread::run ( void *(*)(void *)  start_routine,
void *  data,
int  priority = 0 
)
inline

Start a thread running start_routine, passing data to that function

Parameters
start_routineThe function to run after the thread has been started
dataThe argument to be pased to the thread
priorityThe priority to schedule with if =0 then don't set the priority (pthreads only)
Returns
NO_ERROR on success or THREAD_CREATE_ERROR on failure

Definition at line 126 of file Thread.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ running()

bool Thread::running ( )
inline

Find out if the thread is running.

Returns
true if running, false if stopped.

Definition at line 228 of file Thread.H.

Here is the caller graph for this function:

◆ setPriority()

int Thread::setPriority ( pthread_attr_t *  attributes,
int  priority 
)
inline

Definition at line 160 of file Thread.H.

Here is the call graph for this function:

◆ stop()

void* Thread::stop ( void  )
inline

Force the thread to stop.

Returns
The exit value once the thread is met.
Examples:
IIOQueueTest.C.

Definition at line 107 of file Thread.H.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ thread

pthread_t Thread::thread
private

The thread structure.

Definition at line 69 of file Thread.H.


The documentation for this class was generated from the following file:
gtkIOStream: Thread Class Reference
GTK+ IOStream  Beta