🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #2716

Re: Getting a thread's state and CPU utilization

#2716
From: Dennis Jones
Date: Mon, 15 Jan 2007 05:40
31 lines
2264 bytes
"Dennis Jones" <nospam@nospam.com> wrote in message 
news:45aa8e3b$1@newsgroups.borland.com...
>
> "Bob Gonder" <notbg@notmindspring.invalid> wrote in message 
> news:up0lq2hp43a79vr8hdd05299c556be7bc8@4ax.com...
>> Dennis Jones wrote:
>>
>>>thread terminates.  So if it is not signalled, all I know is that it 
>>>hasn't
>>>terminated -- but I want to know whether or not the thread is in a wait
>>>state (waiting on a synchronization object).
>>
>> And for that part, I had suggested adding a thread-data flag that you
>> would set before and clear after going into wait-states.
>
>
> Yeah, sorry...I guess I misread what you had said.  Unfortunately, I don't 
> have full control of all source code, so I won't always have the ability 
> to set state indicators.  Besides, that would be a lot of effort...it 
> would be much nicer to get that information from the OS, which probably 
> has it.

Thanks to a tip from someone in ms.public.win32.programmer.kernel, I found 
the 'State' and 'WaitReason' members in the SYSTEM_THREAD_INFORMATION 
structure provided by NtQuerySystemInformation(), which I am already 
calling!  Beauty!

I'm going to try it tomorrow.

- Dennis
Technical Details
Message-ID: <45ab13b3$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <45a9e77e$1@newsgroups.borland.com> <999kq2l4vmj0mq60qde1gvpcom1l4arf8a@4ax.com> <45aa5fbf$1@newsgroups.borland.com> <45aa675f$1@newsgroups.borland.com> <up0lq2hp43a79vr8hdd05299c556be7bc8@4ax.com> <45aa8e3b$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,2c2b36b510895e0f
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Dennis Jones" <nospam@nospam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <45a9e77e$1@newsgroups.borland.com> <999kq2l4vmj0mq60qde1gvpcom1l4arf8a@4ax.com> <45aa5fbf$1@newsgroups.borland.com> <45aa675f$1@newsgroups.borland.com> <up0lq2hp43a79vr8hdd05299c556be7bc8@4ax.com> <45aa8e3b$1@newsgroups.borland.com>
Subject: Re: Getting a thread's state and CPU utilization
Date: Sun, 14 Jan 2007 21:40:22 -0800
Lines: 33
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
NNTP-Posting-Host: 71.245.109.58
Message-ID: <45ab13b3$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1168839603 71.245.109.58 (14 Jan 2007 21:40:03 -0800)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail