|
|
Home » U++ Library support » U++ Core » Thread::GetCurrentThreadId() and Thread::GetCurrentThreadHandle() new methods
Re: Thread::GetCurrentThreadId() and Thread::GetCurrentThreadHandle() new methods [message #30603 is a reply to message #30599] |
Tue, 11 January 2011 16:11 |
|
mirek wrote on Tue, 11 January 2011 15:49 | We have
Handle GetHandle() const { return handle; }
but no equivalent for thread ID (whereas we have both as static method).
|
GetHandle is not a static method. GetHandle and GetCurrentHandle are different methods.
Other Idea:
------
To demonstrate that Mirek proposed (customized) a more faster than my proposed (API) I have created a simple test running in threads:
void WorkerThread(DivisorsInfo f)
{
char _l[1000];
Thread::Id id_api;
Thread::IdCustom id_custom;
TimeStop v_timer;
v_timer.Reset();
for(int i=0;i<100000000;++i){
id_custom = Thread::GetCurrentIdCustom();
}
dword v_time_cust = v_timer.Elapsed();
v_timer.Reset();
for(int i=0;i<100000000;++i){
id_api = Thread::GetCurrentId();
}
dword v_time_api1 = v_timer.Elapsed();
sprintf(_l, "Run Thread: %X. api time %u, custom time %u", Thread::GetCurrentIdCustom(), v_time_api1, v_time_cust);
}
and restul under linux (Ubuntu):
Run Thread: B34EEF34. api time 0.991, custom time 1.088. custom realization are faster 0.910846 times
Run Thread: B2CEBF34. api time 1.455, custom time 1.080. custom realization are faster 1.347222 times
Run Thread: B24E8F34. api time 1.862, custom time 0.680. custom realization are faster 2.738235 times
Run Thread: B1CD4F34. api time 2.133, custom time 0.927. custom realization are faster 2.300971 times
Run Thread: B0CAFF34. api time 2.223, custom time 0.698. custom realization are faster 3.184814 times
Run Thread: B14C3F34. api time 2.234, custom time 0.903. custom realization are faster 2.473976 times
Run Thread: B049BF34. api time 2.192, custom time 0.648. custom realization are faster 3.382716 times
Run Thread: AFC87F34. api time 2.030, custom time 0.573. custom realization are faster 3.542757 times
and same code under windows xp
Run Thread: 162229. api time 0.672, custom time 0.390. custom realization are faster 1.723077 times
Run Thread: 167561. api time 0.860, custom time 0.984. custom realization are faster 0.873984 times
Run Thread: 162229. api time 1.219, custom time 1.156. custom realization are faster 1.054498 times
Run Thread: 171BD1. api time 1.265, custom time 0.735. custom realization are faster 1.721088 times
Run Thread: 16C899. api time 1.594, custom time 0.890. custom realization are faster 1.791011 times
Run Thread: 176F09. api time 1.485, custom time 0.578. custom realization are faster 2.569204 times
Run Thread: 17C241. api time 1.485, custom time 0.437. custom realization are faster 3.398169 times
In the end: Mirek realization are approximative 2 times faster than API functionality.
Mirek, can you add your proposed functionality?
[Updated on: Tue, 11 January 2011 17:04] 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: Fri May 17 19:58:15 CEST 2024
Total time taken to generate the page: 0.02606 seconds
|
|
|