Skip to content
Snippets Groups Projects
Commit 2a0095f2 authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Added a function to get the status of the thread.

parent 3fc4a19c
No related branches found
No related tags found
No related merge requests found
...@@ -195,3 +195,21 @@ void CThreadServer::detach_thread(const std::string& thread_id) ...@@ -195,3 +195,21 @@ void CThreadServer::detach_thread(const std::string& thread_id)
thread->detach(); 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();
}
}
...@@ -314,6 +314,12 @@ class CThreadServer ...@@ -314,6 +314,12 @@ class CThreadServer
* must not have any spaces or special characters, and must be unique. * must not have any spaces or special characters, and must be unique.
*/ */
void detach_thread(const std::string& thread_id); void detach_thread(const std::string& thread_id);
/**
* \brief
*
*/
int get_thread_state(const std::string &thread_id);
}; };
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment