Base-class for all loops/threads.
Definition at line 29 of file StoppableThread.h.
Public Member Functions | |
StoppableThread (std::string name) | |
virtual | ~StoppableThread () |
virtual void | ClearQueue () |
virtual std::string | EndStatus () |
virtual size_t | GetItemsCurrent ()=0 |
virtual size_t | GetItemsPopped ()=0 |
virtual size_t | GetItemsPushed ()=0 |
virtual size_t | GetRate ()=0 |
bool | IsPaused () |
bool | IsRunning () |
virtual bool | Iteration ()=0 |
void | Join () |
std::string | Name () const |
virtual void | OnEnd () |
void | Pause () |
virtual std::string | Progress () |
void | Resume () |
virtual std::string | Status () |
void | Stop () |
Static Public Member Functions | |
static std::string | AllThreadHeader () |
static std::string | AllThreadProgress () |
static std::string | AllThreadStatus () |
static bool | AnyThreadRunning () |
static std::string | AnyThreadStatus () |
static void | ClearAllQueues () |
static void | ColumnWidth (size_t val) |
static size_t | ColumnWidth () |
static StoppableThread * | Get (const std::string &name) |
static std::vector< StoppableThread * > | GetAll () |
static int | GetNThreads () |
static void | join_status_thread () |
static void | PauseAll () |
static void | Print () |
static void | ResumeAll () |
static void | SendStop () |
static void | start_status_thread () |
static void | status_out () |
static void | status_out_loop () |
static void | StatusWidth (size_t val) |
static size_t | StatusWidth () |
static void | stop_status_thread () |
static void | StopAll () |
Static Public Attributes | |
static std::thread | fStatusThread |
static bool | fStatusThreadOn = false |
Protected Attributes | |
std::atomic_long | fInputSize {0} |
std::atomic_size_t | fItemsPopped {0} |
std::string | fName |
Static Protected Attributes | |
static std::map< std::string, StoppableThread * > | fThreadMap |
Private Member Functions | |
StoppableThread (const StoppableThread &) | |
ClassDef (StoppableThread, 0) | |
void | Loop () |
StoppableThread & | operator= (const StoppableThread &) |
Private Attributes | |
std::atomic_bool | fForceStop {false} |
std::atomic_bool | fPaused {false} |
std::condition_variable | fPausedWait |
std::mutex | fPauseMutex |
std::atomic_bool | fRunning {false} |
std::thread | fThread |
Static Private Attributes | |
static size_t | fColumnWidth = 20 |
static size_t | fStatusWidth = 80 |
#include <StoppableThread.h>
StoppableThread::StoppableThread | ( | std::string | name | ) |
Definition at line 26 of file StoppableThread.cxx.
References fName, fStatusThreadOn, fThread, fThreadMap, Loop(), and start_status_thread().
|
virtual |
Definition at line 182 of file StoppableThread.cxx.
References fName, fStatusThread, fStatusThreadOn, and fThreadMap.
|
inlineprivate |
Definition at line 101 of file StoppableThread.h.
|
static |
Definition at line 73 of file StoppableThread.cxx.
References fColumnWidth, fStatusWidth, and fThreadMap.
Referenced by TGRSIint::ApplyOptions().
|
static |
Definition at line 59 of file StoppableThread.cxx.
References fColumnWidth, fStatusWidth, and fThreadMap.
Referenced by TGRSIint::LoopUntilDone().
|
static |
Definition at line 83 of file StoppableThread.cxx.
References fColumnWidth, fStatusWidth, and fThreadMap.
Referenced by TGRSIint::LoopUntilDone().
|
static |
Definition at line 37 of file StoppableThread.cxx.
References fThreadMap.
Referenced by TChannel::GetChannel(), TGRSIint::LoopUntilDone(), and TGRSIInterruptHandler::Notify().
|
static |
Definition at line 47 of file StoppableThread.cxx.
References fThreadMap.
|
private |
|
static |
Definition at line 166 of file StoppableThread.cxx.
References fThreadMap.
Referenced by TGRSIInterruptHandler::Notify().
|
inlinevirtual |
Reimplemented in TUnpackingLoop, TDetBuildingLoop, TFragmentChainLoop, TAnalysisHistLoop, TAnalysisWriteLoopClient, TFragHistLoop, TEventBuildingLoop, TDataLoop, TTerminalLoop< T >, TFragWriteLoop, and TAnalysisWriteLoop.
Definition at line 60 of file StoppableThread.h.
|
inlinestatic |
Definition at line 75 of file StoppableThread.h.
References fColumnWidth.
|
inlinestatic |
Definition at line 77 of file StoppableThread.h.
References fColumnWidth.
Referenced by TGRSIint::SetupPipeline().
|
inlinevirtual |
Reimplemented in TUnpackingLoop, TEventBuildingLoop, TFragWriteLoop, and TAnalysisWriteLoop.
Definition at line 57 of file StoppableThread.h.
|
static |
Definition at line 173 of file StoppableThread.cxx.
References fThreadMap.
Referenced by ClassImp(), TTerminalLoop< T >::Get(), TFragHistLoop::Get(), TAnalysisHistLoop::Get(), TAnalysisWriteLoop::Get(), TFragWriteLoop::Get(), TUnpackingLoop::Get(), TFragmentChainLoop::Get(), and TDataLoop::Get().
|
static |
Definition at line 315 of file StoppableThread.cxx.
References fThreadMap.
|
pure virtual |
Implemented in TDetBuildingLoop, TUnpackingLoop, TAnalysisHistLoop, TFragHistLoop, TTerminalLoop< T >, TAnalysisWriteLoopClient, TDataLoop, TEventBuildingLoop, TFragWriteLoop, TFragmentChainLoop, and TAnalysisWriteLoop.
Referenced by status_out().
|
pure virtual |
Implemented in TDetBuildingLoop, TUnpackingLoop, TAnalysisHistLoop, TFragHistLoop, TAnalysisWriteLoopClient, TTerminalLoop< T >, TDataLoop, TEventBuildingLoop, TFragWriteLoop, TFragmentChainLoop, and TAnalysisWriteLoop.
Referenced by status_out().
|
pure virtual |
Implemented in TUnpackingLoop, TAnalysisHistLoop, TFragHistLoop, TDetBuildingLoop, TTerminalLoop< T >, TAnalysisWriteLoopClient, TDataLoop, TEventBuildingLoop, TFragWriteLoop, TFragmentChainLoop, and TAnalysisWriteLoop.
Referenced by status_out().
|
static |
|
pure virtual |
Implemented in TDetBuildingLoop, TUnpackingLoop, TAnalysisHistLoop, TFragHistLoop, TTerminalLoop< T >, TAnalysisWriteLoopClient, TDataLoop, TEventBuildingLoop, TFragWriteLoop, TFragmentChainLoop, and TAnalysisWriteLoop.
Referenced by status_out().
bool StoppableThread::IsPaused | ( | ) |
Definition at line 224 of file StoppableThread.cxx.
References fPaused.
bool StoppableThread::IsRunning | ( | ) |
Definition at line 219 of file StoppableThread.cxx.
References fRunning.
Referenced by status_out().
|
pure virtual |
Implemented in TAnalysisHistLoop, TAnalysisWriteLoopClient, TFragmentChainLoop, TFragHistLoop, TTerminalLoop< T >, TFragWriteLoop, TUnpackingLoop, TAnalysisWriteLoop, TDetBuildingLoop, TDataLoop, and TEventBuildingLoop.
Referenced by Loop().
void StoppableThread::Join | ( | ) |
Definition at line 229 of file StoppableThread.cxx.
References EndStatus(), and fThread.
Referenced by StopAll().
|
static |
Definition at line 280 of file StoppableThread.cxx.
References fStatusThread, and stop_status_thread().
|
private |
Definition at line 237 of file StoppableThread.cxx.
References fPaused, fPausedWait, fPauseMutex, fRunning, Iteration(), and OnEnd().
Referenced by StoppableThread().
|
inline |
Definition at line 58 of file StoppableThread.h.
References fName.
Referenced by TAnalysisWriteLoopClient::AddBranch(), TAnalysisWriteLoop::EndStatus(), TFragWriteLoop::EndStatus(), TUnpackingLoop::EndStatus(), and status_out().
|
inlinevirtual |
Reimplemented in TAnalysisWriteLoopClient, TFragmentChainLoop, TAnalysisWriteLoop, and TDataLoop.
Definition at line 54 of file StoppableThread.h.
Referenced by Loop().
|
inlineprivate |
Definition at line 102 of file StoppableThread.h.
void StoppableThread::Pause | ( | ) |
Definition at line 202 of file StoppableThread.cxx.
|
static |
Definition at line 97 of file StoppableThread.cxx.
References fThreadMap.
|
static |
Definition at line 254 of file StoppableThread.cxx.
References fColumnWidth, fStatusWidth, fThreadMap, GetNThreads(), and hex().
|
virtual |
Definition at line 119 of file StoppableThread.cxx.
References fColumnWidth, fInputSize, and fItemsPopped.
void StoppableThread::Resume | ( | ) |
Definition at line 193 of file StoppableThread.cxx.
References fPaused, fPausedWait, fPauseMutex, and fRunning.
|
static |
Definition at line 104 of file StoppableThread.cxx.
References fThreadMap.
Referenced by TGRSIint::SetupPipeline().
|
static |
Definition at line 135 of file StoppableThread.cxx.
References fThreadMap, and Stop().
Referenced by StopAll(), and TGRSIint::Terminate().
|
static |
Definition at line 265 of file StoppableThread.cxx.
References fStatusThread, fStatusThreadOn, and status_out_loop().
Referenced by StoppableThread().
|
virtual |
Definition at line 111 of file StoppableThread.cxx.
References fColumnWidth, fInputSize, and fItemsPopped.
|
static |
Definition at line 297 of file StoppableThread.cxx.
References fThreadMap, GetItemsCurrent(), GetItemsPopped(), GetItemsPushed(), GetRate(), IsRunning(), and Name().
Referenced by status_out_loop(), and StopAll().
|
static |
Definition at line 286 of file StoppableThread.cxx.
References fStatusThreadOn, and status_out().
Referenced by start_status_thread().
|
inlinestatic |
Definition at line 76 of file StoppableThread.h.
References fStatusWidth.
|
inlinestatic |
Definition at line 78 of file StoppableThread.h.
References fStatusWidth.
Referenced by TGRSIint::SetupPipeline().
void StoppableThread::Stop | ( | ) |
Definition at line 209 of file StoppableThread.cxx.
References EndStatus(), fPaused, fPausedWait, fPauseMutex, and fRunning.
Referenced by SendStop().
|
static |
Definition at line 273 of file StoppableThread.cxx.
References fStatusThreadOn.
Referenced by join_status_thread().
|
static |
Definition at line 147 of file StoppableThread.cxx.
References fThreadMap, Join(), SendStop(), and status_out().
Referenced by TGRSIint::Terminate().
|
staticprivate |
Definition at line 104 of file StoppableThread.h.
Referenced by AllThreadHeader(), AllThreadProgress(), AllThreadStatus(), ColumnWidth(), Print(), Progress(), and Status().
|
private |
Definition at line 112 of file StoppableThread.h.
|
protected |
number of items in the input (queue), only updated within Iteration(), so not always fully up-to-date (signed to hold error from queue::pop)
Definition at line 95 of file StoppableThread.h.
Referenced by TAnalysisWriteLoop::EndStatus(), TFragWriteLoop::EndStatus(), TAnalysisWriteLoopClient::GetInputSize(), TEventBuildingLoop::Iteration(), TDataLoop::Iteration(), TDetBuildingLoop::Iteration(), TAnalysisWriteLoop::Iteration(), TUnpackingLoop::Iteration(), TFragWriteLoop::Iteration(), TFragHistLoop::Iteration(), TFragmentChainLoop::Iteration(), TAnalysisHistLoop::Iteration(), TAnalysisWriteLoopClient::Iteration(), Progress(), and Status().
|
protected |
number of items popped from input queue
Definition at line 94 of file StoppableThread.h.
Referenced by TAnalysisWriteLoop::EndStatus(), TFragWriteLoop::EndStatus(), TEventBuildingLoop::EndStatus(), TFragmentChainLoop::GetItemsPopped(), TFragWriteLoop::GetItemsPopped(), TAnalysisWriteLoop::GetItemsPushed(), TFragmentChainLoop::GetItemsPushed(), TFragWriteLoop::GetItemsPushed(), TAnalysisWriteLoopClient::GetItemsPushed(), TEventBuildingLoop::Iteration(), TDataLoop::Iteration(), TDetBuildingLoop::Iteration(), TAnalysisWriteLoop::Iteration(), TUnpackingLoop::Iteration(), TFragWriteLoop::Iteration(), TFragHistLoop::Iteration(), TFragmentChainLoop::Iteration(), TAnalysisHistLoop::Iteration(), TAnalysisWriteLoopClient::Iteration(), Progress(), TFragmentChainLoop::Restart(), and Status().
|
protected |
Definition at line 99 of file StoppableThread.h.
Referenced by Name(), StoppableThread(), and ~StoppableThread().
|
private |
Definition at line 113 of file StoppableThread.h.
Referenced by IsPaused(), Loop(), Pause(), Resume(), and Stop().
|
private |
Definition at line 114 of file StoppableThread.h.
|
private |
Definition at line 115 of file StoppableThread.h.
|
private |
Definition at line 111 of file StoppableThread.h.
Referenced by IsRunning(), Loop(), Pause(), Resume(), and Stop().
|
static |
Definition at line 81 of file StoppableThread.h.
Referenced by join_status_thread(), start_status_thread(), and ~StoppableThread().
|
static |
Definition at line 83 of file StoppableThread.h.
Referenced by start_status_thread(), status_out_loop(), stop_status_thread(), StoppableThread(), and ~StoppableThread().
|
staticprivate |
Definition at line 105 of file StoppableThread.h.
Referenced by AllThreadHeader(), AllThreadProgress(), AllThreadStatus(), Print(), and StatusWidth().
|
private |
Definition at line 110 of file StoppableThread.h.
Referenced by Join(), and StoppableThread().
|
staticprotected |
Definition at line 91 of file StoppableThread.h.
Referenced by AllThreadHeader(), AllThreadProgress(), AllThreadStatus(), AnyThreadRunning(), AnyThreadStatus(), ClearAllQueues(), Get(), GetAll(), GetNThreads(), PauseAll(), Print(), ResumeAll(), SendStop(), status_out(), StopAll(), StoppableThread(), and ~StoppableThread().