Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ThreadSpawningTimer.cpp

Go to the documentation of this file.
00001 #include "ThreadSpawningTimer.h"
00002 
00007 
00008 ThreadSpawningTimer* ThreadSpawningTimer::m_instance = NULL;
00009 
00010 
00011 ThreadSpawningTimer::ThreadSpawningTimer() : Timer() {
00012     pthread_attr_init(&m_attr);
00013 }
00014 
00015 
00016 ThreadSpawningTimer::~ThreadSpawningTimer() {
00017     pthread_attr_destroy(&m_attr);
00018 }
00019 
00020 
00021 ThreadSpawningTimer*
00022 ThreadSpawningTimer::instance() {
00023     if (m_instance == NULL) {
00024         m_instance = new ThreadSpawningTimer();
00025         m_instance->setName("Thread Spawning Timer");
00026     }
00027     return m_instance;
00028 }
00029 
00030 
00031 void
00032 ThreadSpawningTimer::destroy() {
00033     if (m_instance == NULL) {
00034         return;
00035     }
00036     else {
00037         delete m_instance;
00038         m_instance = NULL;
00039     }
00040 }
00041 
00042 
00043 void
00044 ThreadSpawningTimer::doAction(TimerNode* timerNode) {
00045     pthread_t tid;
00046     pthread_create(&tid, &m_attr, timerNode->getFunc(), timerNode->getArg());
00047     pthread_detach(tid);
00048 }

Generated at Thu Jul 11 13:31:52 2002 for Peekabooty by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001