INTRODUCTION
Overview
Download and Install
Documentation
Publications

REPOSITORY
Libraries

DEVELOPER
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

gbxsickacfr::gbxiceutilacfr::SafeThread Class Reference

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

#include <safethread.h>

Inherits gbxsickacfr::gbxiceutilacfr::Thread.

Inherited by TestThread, and TestThreadWithThrow.

Inheritance diagram for gbxsickacfr::gbxiceutilacfr::SafeThread:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 SafeThread (gbxsickacfr::gbxutilacfr::Tracer &tracer)
 Needs an implementation of Tracer to report possible exceptions.
virtual void run ()
virtual void walk ()=0

Detailed Description

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

If a stray exception is caught, an error message will be printed (using cout), then we will 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

void SafeThread::run (  )  [virtual]

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

virtual void gbxsickacfr::gbxiceutilacfr::SafeThread::walk (  )  [pure virtual]

Implement this function in the derived class and put here all the stuff which your thread needs to do.


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

Generated for GearBox by  doxygen 1.4.5