INTRODUCTION
Overview
Download and Install
Documentation
Publications

REPOSITORY
Libraries

DEVELOPER
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         
gbxiceutilacfr::SafeThread Class Referenceabstract

A version of the Thread class which catches all possible exceptions. More...

#include <safethread.h>

Inheritance diagram for gbxiceutilacfr::SafeThread:
Inheritance graph

Public Member Functions

 SafeThread (gbxutilacfr::Tracer &tracer)
 Needs an implementation of Tracer to report possible exceptions.
 
virtual void run ()
 
- Public Member Functions inherited from gbxiceutilacfr::Thread
void stop ()
 
virtual bool isStopping ()
 Returns TRUE if the thread is in Stopping state, FALSE otherwise.
 
bool isStarted ()
 Returns TRUE if the thread is in Started state, FALSE otherwise.
 
bool isActive ()
 

Additional Inherited Members

- Protected Member Functions inherited from gbxiceutilacfr::Thread
void waitForStop ()
 

Detailed Description

A version of the Thread class which catches all possible exceptions.

If an exception is caught when the thread is not stopping, an error trace message will be printed. Then the thread wil wait for someone to call stop().

To use this class, simply implement the pure virtual walk() function.

void MyThread::walk()
{
    // initialize

    // main loop
    while ( !isStopping() )
    {
        // do something
    }

    // clean up
}
See also
Thread, SubsystemThread.

Member Function Documentation

◆ run()

void SafeThread::run ( )
virtual

This implementation calls walk(), catches all possible exceptions, prints out errors and waits for someone to call stop().

References gbxutilacfr::Tracer::debug(), gbxutilacfr::Tracer::error(), gbxiceutilacfr::Thread::isStopping(), and gbxiceutilacfr::Thread::waitForStop().


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

Generated for GearBox by  doxygen 1.4.5