Inheritance diagram for ResourceThread:
Public Member Functions | |
ResourceThread (std::string desc, boost::barrier &barrier, int count) | |
virtual | ~ResourceThread () |
int | getCompleted () |
virtual void | run () |
virtual void | start () |
Spawns the OS thread. | |
void | join () |
Waits for the OS thread to terminate. | |
bool | isStarted () const |
| |
bool | isStopped () const |
| |
boost::thread & | getBoostThread () |
Accesses the underlying boost::thread, e.g. | |
std::string | getName () |
void | setName (std::string const &s) |
Protected Member Functions | |
void | initAndRun () |
virtual void | beforeRun () |
virtual void | afterRun () |
Protected Attributes | |
boost::thread * | pBoostThread |
bool | bRunning |
std::string | name |
Private Attributes | |
boost::barrier & | barrier |
int | count |
int | completed |
std::vector< std::string > | variants |
Definition at line 59 of file ResourceTest.cpp.
ResourceThread::ResourceThread | ( | std::string | desc, | |
boost::barrier & | barrier, | |||
int | count | |||
) | [inline, explicit] |
virtual ResourceThread::~ResourceThread | ( | ) | [inline, virtual] |
int ResourceThread::getCompleted | ( | ) | [inline] |
Definition at line 85 of file ResourceTest.cpp.
References completed.
Referenced by ResourceTest::testConcurrency().
00086 { 00087 return completed; 00088 }
virtual void ResourceThread::run | ( | ) | [inline, virtual] |
Implements Thread.
Definition at line 90 of file ResourceTest.cpp.
References barrier, completed, count, and variants.
00091 { 00092 try { 00093 barrier.wait(); 00094 00095 for (int i = 0; i < count; i++) { 00096 std::string &variant = variants[i]; 00097 00098 Locale locale("en", "US", variant); 00099 00100 FennelResource::instance(locale).sysCallFailed(variant); 00101 00102 completed++; 00103 } 00104 } catch (...) { 00105 completed = -1; 00106 } 00107 }
void Thread::initAndRun | ( | ) | [protected, inherited] |
Definition at line 66 of file Thread.cpp.
References Thread::afterRun(), Thread::beforeRun(), and Thread::run().
Referenced by Thread::start().
void Thread::beforeRun | ( | ) | [protected, virtual, inherited] |
Definition at line 73 of file Thread.cpp.
References Thread::bRunning.
Referenced by Thread::initAndRun().
00074 { 00075 bRunning = true; 00076 }
void Thread::afterRun | ( | ) | [protected, virtual, inherited] |
Definition at line 78 of file Thread.cpp.
References Thread::bRunning.
Referenced by Thread::initAndRun().
00079 { 00080 bRunning = false; 00081 }
void Thread::start | ( | ) | [virtual, inherited] |
Spawns the OS thread.
Definition at line 50 of file Thread.cpp.
References Thread::initAndRun(), and Thread::pBoostThread.
Referenced by AioLinuxScheduler::AioLinuxScheduler(), AioPollingScheduler::AioPollingScheduler(), StatsTimer::start(), ResourceTest::testConcurrency(), and LocalConditionTest::testNotifyAll().
00051 { 00052 pBoostThread = new boost::thread( 00053 boost::bind(&Thread::initAndRun,this)); 00054 }
void Thread::join | ( | ) | [inherited] |
Waits for the OS thread to terminate.
Definition at line 56 of file Thread.cpp.
References Thread::pBoostThread.
Referenced by CheckpointThread::closeImpl(), TimerThread::stop(), AioPollingScheduler::stop(), AioLinuxScheduler::stop(), ResourceTest::testConcurrency(), and LocalConditionTest::testNotifyAll().
00057 { 00058 assert(pBoostThread); 00059 boost::thread t; 00060 assert(*pBoostThread != t); 00061 pBoostThread->join(); 00062 delete pBoostThread; 00063 pBoostThread = NULL; 00064 }
bool Thread::isStarted | ( | ) | const [inline, inherited] |
Reimplemented in AioLinuxScheduler.
Definition at line 71 of file Thread.h.
Referenced by CheckpointThread::closeImpl(), CacheImpl< PageT, VictimPolicyT >::closeImpl(), AioLinuxScheduler::isStarted(), and TimerThread::stop().
00072 { 00073 return pBoostThread ? true : false; 00074 }
bool Thread::isStopped | ( | ) | const [inline, inherited] |
Definition at line 79 of file Thread.h.
00080 { 00081 return !isStarted(); 00082 }
boost::thread& Thread::getBoostThread | ( | ) | [inline, inherited] |
Accesses the underlying boost::thread, e.g.
for use in a boost::thread_group. This thread must already be started.
Definition at line 90 of file Thread.h.
00091 { 00092 assert(isStarted()); 00093 return *pBoostThread; 00094 }
std::string Thread::getName | ( | ) | [inline, inherited] |
void Thread::setName | ( | std::string const & | s | ) | [inline, inherited] |
boost::barrier& ResourceThread::barrier [private] |
int ResourceThread::count [private] |
int ResourceThread::completed [private] |
std::vector<std::string> ResourceThread::variants [private] |
boost::thread* Thread::pBoostThread [protected, inherited] |
Definition at line 44 of file Thread.h.
Referenced by Thread::join(), Thread::start(), Thread::Thread(), and Thread::~Thread().
bool Thread::bRunning [protected, inherited] |
Definition at line 45 of file Thread.h.
Referenced by Thread::afterRun(), Thread::beforeRun(), Thread::Thread(), and Thread::~Thread().
std::string Thread::name [protected, inherited] |