|
|
Home » U++ Library support » U++ Core » Thread::GetCurrentThreadId() and Thread::GetCurrentThreadHandle() new methods
Thread::GetCurrentThreadId() and Thread::GetCurrentThreadHandle() new methods [message #30539] |
Fri, 07 January 2011 16:38 |
|
Hello All,
I propose to add new static methods to Thread class:
class Thread : NoCopy {
public:
#ifdef PLATFORM_WIN32
typedef HANDLE HandleType;
typedef dword IdType;
#elif defined(PLATFORM_POSIX)
typedef pthread_t HandleType;
typedef pthread_t IdType;
#else
#error Thread is not support for this platform
#endif
private:
HandleType handle;
....
public:
static IdType GetCurrentThreadId();
static HandleType GetCurrentThreadHandle();
...
and cpp source c ode:
Thread::IdType Thread::GetCurrentThreadId(){
#ifdef PLATFORM_WIN32
return GetCurrentThreadId();
#elif defined(PLATFORM_POSIX)
return pthread_self();
#else
#error Thread is not support for this platform
#endif
}
Thread::HandleType Thread::GetCurrentThreadHandle(){
#ifdef PLATFORM_WIN32
return GetCurrentThread();
#elif defined(PLATFORM_POSIX)
return pthread_self();
#else
#error Thread is not support for this platform
#endif
}
This method help me to identify the current thread id.
ADD: new method: Thread::GetCurrentThreadHandle
Best regards,
Ion
[Updated on: Fri, 07 January 2011 16:45] Report message to a moderator
|
|
|
|
|
Thread::GetCurrentThreadId() and Thread::GetCurrentThreadHandle() new methods
By: tojocky on Fri, 07 January 2011 16:38
|
|
|
Re: Thread::GetCurrentThreadId() and Thread::GetCurrentThreadHandle() new methods
By: mirek on Sat, 08 January 2011 13:07
|
|
|
Re: Thread::GetCurrentThreadId() and Thread::GetCurrentThreadHandle() new methods
By: tojocky on Sun, 09 January 2011 22:28
|
|
|
Re: Thread::GetCurrentThreadId() and Thread::GetCurrentThreadHandle() new methods
By: mirek on Sun, 09 January 2011 22:49
|
|
|
Re: Thread::GetCurrentThreadId() and Thread::GetCurrentThreadHandle() new methods
By: tojocky on Mon, 10 January 2011 15:35
|
|
|
Re: Thread::GetCurrentThreadId() and Thread::GetCurrentThreadHandle() new methods
|
|
|
Re: Thread::GetCurrentThreadId() and Thread::GetCurrentThreadHandle() new methods
By: mirek on Mon, 10 January 2011 17:48
|
|
|
Re: Thread::GetCurrentThreadId() and Thread::GetCurrentThreadHandle() new methods
By: tojocky on Mon, 10 January 2011 19:13
|
|
|
Re: Thread::GetCurrentThreadId() and Thread::GetCurrentThreadHandle() new methods
By: mirek on Tue, 11 January 2011 14:49
|
|
|
Re: Thread::GetCurrentThreadId() and Thread::GetCurrentThreadHandle() new methods
By: tojocky on Tue, 11 January 2011 16:11
|
|
|
Re: Thread::GetCurrentThreadId() and Thread::GetCurrentThreadHandle() new methods
By: mirek on Wed, 12 January 2011 09:49
|
|
|
Re: Thread::GetCurrentThreadId() and Thread::GetCurrentThreadHandle() new methods
By: tojocky on Wed, 12 January 2011 12:36
|
|
|
Re: Thread::GetCurrentThreadId() and Thread::GetCurrentThreadHandle() new methods
By: mirek on Wed, 12 January 2011 20:40
|
|
|
Re: Thread::GetCurrentThreadId() and Thread::GetCurrentThreadHandle() new methods
By: tojocky on Thu, 13 January 2011 11:47
|
|
|
Re: Thread::GetCurrentThreadId() and Thread::GetCurrentThreadHandle() new methods
By: mirek on Thu, 13 January 2011 20:51
|
|
|
Re: Thread::GetCurrentThreadId() and Thread::GetCurrentThreadHandle() new methods
By: tojocky on Fri, 14 January 2011 08:12
|
Goto Forum:
Current Time: Tue Apr 30 04:39:57 CEST 2024
Total time taken to generate the page: 0.03006 seconds
|
|
|