Page 1 of 1

Threads & ProcExp (SysInternals)

Posted: Fri Jan 06, 2012 7:24 pm
by jassing
If I look at a pb program running in ProcExp from sysinternals/microsoft, I can see thread information -- bu the thread ID in procexp does not match up with threadid() from PB -- I have a thread that is eating up a lot of cpu cycles... problem is that the threads depend on each other, so if I disable one thread, the other has nothing to do; so the cpu % drops...

any idea how to line up the process id and thread id with what the system reports as thread id's?

Re: Threads & ProcExp (SysInternals)

Posted: Fri Jan 06, 2012 9:20 pm
by c4s
Yes and probably no. :?

Re: Threads & ProcExp (SysInternals)

Posted: Fri Jan 06, 2012 10:33 pm
by rsts
jassing wrote:If I look at a pb program running in ProcExp from sysinternals/microsoft, I can see thread information -- bu the thread ID in procexp does not match up with threadid() from PB -- I have a thread that is eating up a lot of cpu cycles... problem is that the threads depend on each other, so if I disable one thread, the other has nothing to do; so the cpu % drops...
Twitter message?

Re: Threads & ProcExp (SysInternals)

Posted: Sun Jan 08, 2012 10:06 pm
by cas
ThreadID() only returns handle, not ID. It is a bit misleading.

Code: Select all

Procedure work(void=0)
  Debug "Thread ID:"+Str(GetCurrentThreadId_())
  Repeat
    Delay(1)
  Until GetAsyncKeyState_(#VK_ESCAPE)
EndProcedure

Debug "Start Address: "+GetFilePart(ProgramFilename())+"+0x"+Hex(@work()-$400000)
thr=CreateThread(@work(),0)
If thr
  Debug "Handle: "+Str(ThreadID(thr))
  WaitThread(thr)
EndIf

Re: Threads & ProcExp (SysInternals)

Posted: Mon Jan 09, 2012 6:53 am
by jassing
Thanks.