diff --git a/src/gui/components/cc_timer.cpp b/src/gui/components/cc_timer.cpp index 11ae9b35e..a7b7e13ca 100644 --- a/src/gui/components/cc_timer.cpp +++ b/src/gui/components/cc_timer.cpp @@ -33,11 +33,13 @@ #include #include #include +#include using namespace std; CComponentsTimer::CComponentsTimer(const int& interval, bool is_nano) { + name = "unnamed"; tm_thread = 0; tm_interval = interval; tm_enable_nano = is_nano; @@ -56,7 +58,8 @@ CComponentsTimer::~CComponentsTimer() void CComponentsTimer::runSharedTimerAction() { //start loop - + string tn = "cc:"+name; + set_threadname(tn.c_str()); while(tm_enable && tm_interval > 0) { tm_mutex.lock(); OnTimer(); diff --git a/src/gui/components/cc_timer.h b/src/gui/components/cc_timer.h index 530224f40..c7e2d21cd 100644 --- a/src/gui/components/cc_timer.h +++ b/src/gui/components/cc_timer.h @@ -63,6 +63,9 @@ class CComponentsTimer : public sigc::trackable ///flag to control thread state bool tm_enable; + ///name for the thread + std::string name; + ///mutex for timer OpenThreads::Mutex tm_mutex; ///slot for restart signals @@ -120,6 +123,13 @@ class CComponentsTimer : public sigc::trackable */ void setTimerInterval(const int& interval, bool is_nano = false); + /**set thread name + * @param[in] thread name + * @return + * void + */ + void setThreadName(const std::string& n) { name = n; }; + /**Provides a signal handler to receive any function or methode. * Use this in your class where ever you need time controled actions. *