sudhakar_koundinya
asked on
Determining thread count
Friends,
How to know, no of threads that are executing currently
Currently I am taking one global variable and incrementing and decrementing the variable using following methods in determining the thread count
::InterlockedIncrement(&th readCounte r);
::InterlockedDecrement(&th readCounte r);
Rather using above idea, I want the idea similar to this where I can know direct thread count
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Thread.html#activeCount()
thanks
sudhakar
How to know, no of threads that are executing currently
Currently I am taking one global variable and incrementing and decrementing the variable using following methods in determining the thread count
::InterlockedIncrement(&th
::InterlockedDecrement(&th
Rather using above idea, I want the idea similar to this where I can know direct thread count
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Thread.html#activeCount()
thanks
sudhakar
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
BTW, a more complicated solution would be to 'CreateToolhelp32Snapshot( TH32CS_SNA PTHREAD, GetCurrentProcessId());' and counting the threads, but...
>>See the above code.
This is not a direct thread count, just a trick similar to author proposal.
Your second alternative has the same flavour.
Java language, which I don't like to use by the way, mantains an internal ready-made thread list and counter.
Also you can have a similar counter with .net environment with System.Threading.ThreadPoo l class (have a look to ).
But I have not seen a "GetThreadCount" function in WinAPI.
This is not a direct thread count, just a trick similar to author proposal.
Your second alternative has the same flavour.
Java language, which I don't like to use by the way, mantains an internal ready-made thread list and counter.
Also you can have a similar counter with .net environment with System.Threading.ThreadPoo
But I have not seen a "GetThreadCount" function in WinAPI.
>>This is not a direct thread count, just a trick
I tend to object. You might want to explain why this does not work rather than only claiming that.
Just in case I haven't been clear, I was speaking of an implicitly loaded DLL. And I am really courious about the reason why a 'snapshot' should be a 'trick'.
I tend to object. You might want to explain why this does not work rather than only claiming that.
Just in case I haven't been clear, I was speaking of an implicitly loaded DLL. And I am really courious about the reason why a 'snapshot' should be a 'trick'.
See the above code.