diff --git a/src/threads/threadserver.cpp b/src/threads/threadserver.cpp index 90a23636b8b3bbd6e4f15de8a2d4f1ab1643935a..026ad40c8510fb32caa02258aa62613cc836612f 100644 --- a/src/threads/threadserver.cpp +++ b/src/threads/threadserver.cpp @@ -195,3 +195,21 @@ void CThreadServer::detach_thread(const std::string& thread_id) thread->detach(); } } + +int CThreadServer::get_thread_state(const std::string &thread_id) +{ + std::list<CThread>::iterator thread; + + this->access_threads.enter(); + if((thread=this->search_thread(thread_id))==(std::list<CThread>::iterator)NULL) + { + this->access_threads.exit(); + /* handle exceptions */ + throw CThreadServerException(_HERE_,"Unknown thread",thread_id); + } + else + { + this->access_threads.exit(); + return thread->get_state(); + } +} diff --git a/src/threads/threadserver.h b/src/threads/threadserver.h index 3aa8be9ef3d42aa63a3385dbc52e8840e2530ce9..fe8f60abda6ea71464e97aa77cedffd8421afe9c 100644 --- a/src/threads/threadserver.h +++ b/src/threads/threadserver.h @@ -314,6 +314,12 @@ class CThreadServer * must not have any spaces or special characters, and must be unique. */ void detach_thread(const std::string& thread_id); + + /** + * \brief + * + */ + int get_thread_state(const std::string &thread_id); }; #endif