All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions | Static Public Member Functions | Protected Member Functions
GpCoreTools::PThread Class Reference

Brief description of class still missing. More...

#include <PThread.h>

Inheritance diagram for GpCoreTools::PThread:
CubeDevice PPSDevice UbxDevice

List of all members.

Public Member Functions

std::vector< TraceBug * > * bugStack ()
EventLoopeventLoop () const
pthread_t id () const
 PThread ()
void setEventLoop (EventLoop *l)
std::vector< const TraceStamp * > * stack ()
void start ()
void stop ()
void wait ()
virtual ~PThread ()

Static Public Member Functions

static std::list< std::vector
< TraceBug * > * > 
bugStacks ()
static PThreadcurrentThread ()
static void init ()
static void lockThreads ()
static std::list< std::vector
< const TraceStamp * > * > 
stacks ()
static void unlockThreads ()

Protected Member Functions

virtual void run ()=0

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

{
  _eventLoop=0;
}
virtual GpCoreTools::PThread::~PThread ( ) [inline, virtual]
{}

Member Function Documentation

std::vector<TraceBug *>* GpCoreTools::PThread::bugStack ( ) [inline]

Referenced by GpCoreTools::TraceBug::TraceBug().

{return &_bugStack;}
std::list< std::vector< TraceBug * > * > GpCoreTools::PThread::bugStacks ( ) [static]

References GpCoreTools::TraceBug::mainStack().

{
  std::list< std::vector<TraceBug *> * > list;
  list.push_back(TraceBug::mainStack());
  for(std::map<pthread_t, PThread *>::iterator it=_threads.begin(); it!=_threads.end(); it++ ) {
    list.push_back(it->second->bugStack());
  }
  return list;
}

Referenced by GpCoreTools::EventLoop::EventLoop(), GpCoreTools::EventLoop::instance(), GpCoreTools::Trace::Trace(), and GpCoreTools::TraceBug::TraceBug().

{
  pthread_mutex_lock(&_threadsMutex);
  pthread_t id=pthread_self();
  std::map<pthread_t, PThread *>::iterator it;
  it=_threads.find(id);
  PThread * t;
  if(it!=_threads.end()) {
    t=it->second;
  } else {
    t=0;
  }
  pthread_mutex_unlock(&_threadsMutex);
  return t;
}

Referenced by GpCoreTools::EventLoop::instance().

{return _eventLoop;}
pthread_t GpCoreTools::PThread::id ( ) const [inline]
{return _id;}
void GpCoreTools::PThread::init ( ) [static]

Referenced by GpCoreTools::CoreApplication::CoreApplication().

{
  assert(pthread_mutex_init(&_threadsMutex, 0)==0);
}
static void GpCoreTools::PThread::lockThreads ( ) [inline, static]

Referenced by GpCoreTools::CoreApplication::osSignal().

{pthread_mutex_lock(&_threadsMutex);}
virtual void GpCoreTools::PThread::run ( ) [protected, pure virtual]

Referenced by start().

Usually never called. EventLoop's constructor does it for you. You can create only one event loop per thread.

Referenced by GpCoreTools::EventLoop::EventLoop().

{
  assert(!_eventLoop);
  _eventLoop=l;
}
std::vector<const TraceStamp *>* GpCoreTools::PThread::stack ( ) [inline]

Referenced by GpCoreTools::Trace::Trace().

{return &_stack;}
std::list< std::vector< const TraceStamp * > * > GpCoreTools::PThread::stacks ( ) [static]

References GpCoreTools::Trace::mainStack().

Referenced by GpCoreTools::CoreApplication::osSignal().

{
  std::list< std::vector<const TraceStamp *> * > list;
  list.push_back(Trace::mainStack());
  for(std::map<pthread_t, PThread *>::iterator it=_threads.begin(); it!=_threads.end(); it++ ) {
    list.push_back(it->second->stack());
  }
  return list;
}

References run().

Referenced by main().

{
  pthread_attr_t attr;
  pthread_attr_init(&attr);
  pthread_create(&_id, &attr, run, this);
}
static void GpCoreTools::PThread::unlockThreads ( ) [inline, static]

Referenced by GpCoreTools::CoreApplication::osSignal().

{pthread_mutex_unlock(&_threadsMutex);}

Referenced by CubeDaemonApplication::close(), and GpsDaemonApplication::close().

{
  pthread_join(_id, 0);
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines