n2nc::sync::Thread Class Reference

Base Threads interface. More...

#include <thread.h>

Inheritance diagram for n2nc::sync::Thread:

Inheritance graph
[legend]
Collaboration diagram for n2nc::sync::Thread:

Collaboration graph
[legend]

List of all members.

Public Member Functions

int run (void *args)
int wait (void **retval)
void * getRetVal ()
int terminate ()
int getID ()
bool isEquals (Thread *t)
std::string toString ()
void setName (std::string name)

Static Public Member Functions

static bool compare (Thread &t1, Thread &t2)
static bool init ()
static ThreadgetCurrent ()

Protected Member Functions

virtual int pre_start ()
virtual void * entry_point ()=0
virtual int exit_point ()

Protected Attributes

void * m_args
void * m_ret_args
pthread_t m_thread


Detailed Description

Base Threads interface.

Author:
fabsoft <fabsoft@gmail.com>
Examples:

socket_ex.cpp, and threads_ex.cpp.

Definition at line 15 of file thread.h.


Member Function Documentation

int n2nc::sync::Thread::run ( void *  args  ) 

Runs the thread by calling entry_point() routine

Examples:
socket_ex.cpp, and threads_ex.cpp.

Definition at line 21 of file thread.cpp.

Referenced by n2nc::net::SocketEventsHandler::waitForEvents().

Here is the caller graph for this function:

int n2nc::sync::Thread::wait ( void **  retval  ) 

Waits (join) the thread and returns the exit-value

Definition at line 41 of file thread.cpp.

void * n2nc::sync::Thread::getRetVal (  ) 

FIXME getRetVal

Examples:
threads_ex.cpp.

Definition at line 123 of file thread.cpp.

int n2nc::sync::Thread::terminate (  ) 

Cancels the thread execution

Examples:
socket_ex.cpp.

Definition at line 35 of file thread.cpp.

int n2nc::sync::Thread::getID (  ) 

the thread ID

bool n2nc::sync::Thread::isEquals ( Thread t  ) 

Compares thread t. Same of Thread::compare(this, t2)

std::string n2nc::sync::Thread::toString (  ) 

Returns:
the thread name/description

Definition at line 119 of file thread.cpp.

int n2nc::sync::Thread::pre_start (  )  [protected, virtual]

setups thread function

Definition at line 16 of file thread.cpp.

virtual void* n2nc::sync::Thread::entry_point (  )  [protected, pure virtual]

must implements thread code

Implemented in n2nc::net::SocketEventsHandler, and ThreadTest.

int n2nc::sync::Thread::exit_point (  )  [protected, virtual]

must sets the thread in non-running state, here it should implements clean-up routine

Definition at line 28 of file thread.cpp.


The documentation for this class was generated from the following files:

Generated on Mon Oct 6 19:32:59 2008 for n2nc by  doxygen 1.5.5