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 Reference

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

#include <safethread.h>

Inherits gbxiceutilacfr::Thread.

Inherited by gbxserialdeviceacfr::SerialDeviceHandler, gbxsmartbatteryacfr::OceanServer, TestThread, and TestThreadWithThrow.

List of all members.

Public Member Functions

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


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

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