Link to home
Start Free TrialLog in
Avatar of rapidlord
rapidlord

asked on

catching current thread

what i need is to catch thread in moment when it`s active, when i create thread with:
 thread[2]=AfxBeginThread(working, hWnd, THREAD_PRIORITY_NORMAL); //CWinThread* thread[100];
  thread[2] get decimal value (%d) for example '42815072' but when i call:

CurrentThread=AfxGetThread()->m_nThreadID // volatile unsigned int CurrentThread;
CurrentThread get decimal value (%d) fo example '1554',  but i now that CurrentThread in that moment
is thread[2].

How can i compare current thread with some thread from line thread[100] example
if ( AfxGetThread()->m_nThreadID==thread[2]) {// ......  } can be done in this way or there is another tactic.
Or haw can i get shorter value (1554) in thread[2] so i can compere it with
AfxGetThread()->m_nThreadID

tnx for your time.

Vlad
Avatar of Priyesh
Priyesh

GetCurrentThreadID() gives you the thread id of the thread you are currently in.

Avatar of rapidlord

ASKER

GetCurrentThreadID() returning the same value like AfxGetThread()->m_nThreadID so its again same thing i can compare it with 'thread[2]' IT`S NOT THAT.

sory
GetCurrentThreadID() returning the same value like AfxGetThread()->m_nThreadID so its again same thing i can compare it with 'thread[2]' IT`S NOT THAT.

sory
GetCurrentThreadID() returning the same value like AfxGetThread()->m_nThreadID so its again same thing i can compare it with 'thread[2]' IT`S NOT THAT.

sory
Hi No its not same
Thread id and thread handle both are different thing you can not compare these two

ASKER CERTIFIED SOLUTION
Avatar of Zoppo
Zoppo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial