Main Page   Packages   Class Hierarchy   Alphabetical List   Data Structures   File List   Namespace Members   Data Fields   Globals  

clawsoft.Thread Class Reference

#include <Thread.h>

Inheritance diagram for clawsoft.Thread:

Inheritance graph
[legend]
Collaboration diagram for clawsoft.Thread:

Collaboration graph
[legend]

Detailed Description

This class encapsulates the thread library functionality through SDL and GNU Pth.

Definition at line 21 of file Thread.h.

Public Methods

 Thread ()
 Default constructor.

virtual ~Thread ()
 This is the class destructor, it simply calls detach for cleanup purposes.

int start ()
 Call this method when you want to start running your thread.

virtual void * run ()=0
 Very important
You must override this method so you can provide the thread process itself whatever you define this method does in your subclass is what the thread will start doing when you call start()


void killMe ()
 This method detaches the thread from the current running program, just like detach() does.

char * getClassName ()
 Returns the name of the current class.


Data Fields

bool autodetach
 This variable is just for knowing if the thread can be autodetached or no, currently it does nothing, but is here for backward compatibility.


Protected Methods

int _start ()
 This is a wrapper and is intended to be used only for derived classes.

void detach ()
 This method detaches the thread from the current running program.

void setClassName (char *n)
 Call this method when you need to set the name of the class you're creating, typically int it's constructor, remeber that you must set the classname for every clas you create, that way you can have more information while being in a debuging process.


Static Private Methods

int runMethod (void *thethread)
 This is the wrapping function which calls the run method so it can be executed as a thread, for GNU Pth this function must return an int.


Private Attributes

SDL_Thread * thread
 Thread identifier this one is used when GNU Pth has been activated.


Constructor & Destructor Documentation

clawsoft.Thread::Thread  
 

Default constructor.

Definition at line 18 of file Thread.cpp.

References clawsoft.Object.setClassName().

virtual clawsoft.Thread.~Thread   [inline, virtual]
 

This is the class destructor, it simply calls detach for cleanup purposes.

Definition at line 52 of file Thread.h.

References clawsoft.Thread.detach().


Member Function Documentation

int clawsoft.Thread::_start   [protected]
 

This is a wrapper and is intended to be used only for derived classes.

Definition at line 44 of file Thread.cpp.

References clawsoft.Thread.start(), and clawsoft.Thread.thread.

void clawsoft.Thread::detach   [protected]
 

This method detaches the thread from the current running program.

Definition at line 33 of file Thread.cpp.

References clawsoft.Thread.thread.

Referenced by clawsoft.Thread.~Thread().

char * clawsoft.Object::getClassName   [inherited]
 

Returns the name of the current class.

Definition at line 18 of file Object.cpp.

References clawsoft.Object.__cls_name.

void clawsoft.Thread::killMe  
 

This method detaches the thread from the current running program, just like detach() does.

Definition at line 54 of file Thread.cpp.

References clawsoft.Thread.thread.

void * clawsoft.Thread::run   [pure virtual]
 

Very important
You must override this method so you can provide the thread process itself whatever you define this method does in your subclass is what the thread will start doing when you call start()

Implemented in Client.

Definition at line 76 of file Thread.cpp.

Referenced by clawsoft.Thread.runMethod().

int clawsoft.Thread::runMethod void *    thethread [static, private]
 

This is the wrapping function which calls the run method so it can be executed as a thread, for GNU Pth this function must return an int.

Definition at line 65 of file Thread.cpp.

References clawsoft.Thread.run().

Referenced by clawsoft.Thread.start().

void clawsoft.Object::setClassName char *    n [protected, inherited]
 

Call this method when you need to set the name of the class you're creating, typically int it's constructor, remeber that you must set the classname for every clas you create, that way you can have more information while being in a debuging process.

Definition at line 14 of file Object.cpp.

References clawsoft.Object.__cls_name.

Referenced by clawsoft.ArrayOutOfBoundsException.ArrayOutOfBoundsException(), clawsoft.BrokenPipeException.BrokenPipeException(), clawsoft.Dialog.CancelButton.CancelButton(), clawsoft.CantLoadDSOException.CantLoadDSOException(), clawsoft.CantUnloadDSOException.CantUnloadDSOException(), clawsoft.ConnectionRefusedException.ConnectionRefusedException(), clawsoft.ConnectionTimeoutException.ConnectionTimeoutException(), clawsoft.Dialog.Dialog(), clawsoft.DSOException.DSOException(), clawsoft.DSOSymbolException.DSOSymbolException(), clawsoft.ElementNotFoundException.ElementNotFoundException(), clawsoft.Font.Font(), clawsoft.GameSelector.GameSelector(), clawsoft.Dialog.HelpButton.HelpButton(), clawsoft.IOException.IOException(), clawsoft.KeyboardEvent.KeyboardEvent(), clawsoft.LoginDialog.LoginDialog(), clawsoft.Mutex.Mutex(), clawsoft.MutexException.MutexException(), clawsoft.NetworkException.NetworkException(), clawsoft.NetworkUnreachableException.NetworkUnreachableException(), clawsoft.NoMoreTokensException.NoMoreTokensException(), clawsoft.NullPointerException.NullPointerException(), clawsoft.NumberException.NumberException(), clawsoft.Object.Object(), clawsoft.Dialog.OKButton.OKButton(), clawsoft.Plugin.Plugin(), clawsoft.ProcOutOfFileDescriptorsException.ProcOutOfFileDescriptorsException(), Random.Random(), clawsoft.ServerSocket.ServerSocket(), clawsoft.Socket.Socket(), clawsoft.SocketAlreadyBoundedException.SocketAlreadyBoundedException(), clawsoft.SocketAlreadyUsedException.SocketAlreadyUsedException(), clawsoft.SocketUnableToReadException.SocketUnableToReadException(), clawsoft.SocketUnableToWriteException.SocketUnableToWriteException(), clawsoft.SysOutOfFileDescriptorsException.SysOutOfFileDescriptorsException(), clawsoft.TextBox.TextBox(), clawsoft.TextButton.TextButton(), clawsoft.TextField.TextField(), clawsoft.Thread.Thread(), clawsoft.UnableToLockMutexException.UnableToLockMutexException(), clawsoft.UnableToUnlockMutexException.UnableToUnlockMutexException(), and clawsoft.Window.Window().

int clawsoft.Thread::start  
 

Call this method when you want to start running your thread.

Definition at line 22 of file Thread.cpp.

References clawsoft.Thread.runMethod(), and clawsoft.Thread.thread.

Referenced by clawsoft.Thread._start(), and Server.start().


Field Documentation

bool clawsoft.Thread.autodetach
 

This variable is just for knowing if the thread can be autodetached or no, currently it does nothing, but is here for backward compatibility.

Definition at line 48 of file Thread.h.

SDL_Thread* clawsoft.Thread.thread [private]
 

Thread identifier this one is used when GNU Pth has been activated.

Definition at line 32 of file Thread.h.

Referenced by clawsoft.Thread._start(), clawsoft.Thread.detach(), clawsoft.Thread.killMe(), and clawsoft.Thread.start().


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

Powered by:

SourceForge Logo