mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 09:12:28 +02:00
set thread name (#3664)
* set thread name * fix dead lock * fix code style & return fake name * fix code style * fix code style Co-authored-by: Aleksandar Fabijanic <aleks-f@users.noreply.github.com>
This commit is contained in:
@@ -95,6 +95,7 @@ public:
|
||||
|
||||
void setName(const std::string& name);
|
||||
/// Sets the name of the thread.
|
||||
/// Note that it only take effect before start method invoked.
|
||||
|
||||
void setPriority(Priority prio);
|
||||
/// Sets the thread's priority.
|
||||
@@ -275,10 +276,8 @@ private:
|
||||
Thread& operator = (const Thread&);
|
||||
|
||||
int _id;
|
||||
std::string _name;
|
||||
ThreadLocalStorage* _pTLS;
|
||||
Event _event;
|
||||
mutable FastMutex _mutex;
|
||||
|
||||
friend class ThreadLocalStorage;
|
||||
friend class PooledThread;
|
||||
@@ -302,17 +301,13 @@ inline int Thread::id() const
|
||||
|
||||
inline std::string Thread::name() const
|
||||
{
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
|
||||
return _name;
|
||||
return getNameImpl();
|
||||
}
|
||||
|
||||
|
||||
inline std::string Thread::getName() const
|
||||
{
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
|
||||
return _name;
|
||||
return getNameImpl();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user