IThreadGroup Class Referenceabstract

Interface that defines a group of threads. More...

#include <IThread.hpp>

Inheritance diagram for IThreadGroup:
Inheritance graph

Public Member Functions

virtual ~IThreadGroup ()
virtual void add (void *(*mainloop)(void *), void *data)=0
virtual void start ()=0
virtual ISynchronizergetSynchro ()=0
virtual size_t size () const =0
virtual IThreadoperator[] (size_t idx)=0
virtual void addException (system::Exception e)=0
virtual bool hasExceptions () const =0
virtual Exception getException () const =0
- Public Member Functions inherited from ISmartPointer
virtual ~ISmartPointer ()
virtual void use ()=0
virtual void forget ()=0

Detailed Description

Interface that defines a group of threads.

This interface allows to manage a group of threads; it may be used to access a shared object by different threads.

This class is not intended to be used by end users; instead, the ThreadObject class can be used.

Constructor & Destructor Documentation

virtual ~IThreadGroup ( )


Member Function Documentation

virtual void add ( void *(*)(void *)  mainloop,
void *  data 
pure virtual

Add a thread to the group. A thread is created and the provided mainloop is launched as the main function of this thread.

[in]mainloop: mainloop of the added thread.
[in]data: data to be given to the main loop

Implemented in ThreadGroup.

virtual void addException ( system::Exception  e)
pure virtual

This method is used to gather exceptions occurring during the execution of the threads of the group. By doing this, we can launch an ExceptionComposite when all the threads of the group are finished.

[in]e: exception thrown by one of the thread.

Implemented in ThreadGroup.

virtual Exception getException ( ) const
pure virtual

Get an exception that holds all the information of exceptions that have occurred during the execution of the threads of the group.

the gathering exception.

Implemented in ThreadGroup.

virtual ISynchronizer* getSynchro ( )
pure virtual

Get the synchronizer associated to this threads group.

the ISynchronizer instance.

Implemented in ThreadGroup.

virtual bool hasExceptions ( ) const
pure virtual

Tells whether or not exceptions have been added to the thread group.

true if some exception has been added, false otherwise

Implemented in ThreadGroup.

virtual IThread* operator[] ( size_t  idx)
pure virtual

Get the ith thread of the group.

[in]idx: index of the thread in the group
the thread

Implemented in ThreadGroup.

virtual size_t size ( ) const
pure virtual

Get the number of threads in the group.

the number of threads

Implemented in ThreadGroup.

virtual void start ( )
pure virtual

Start all the threads of the group at the same time. Implementations should ensure this by some synchronization mechanism.

Implemented in ThreadGroup.

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