Article View: borland.public.cppbuilder.nativeapi
Article #2713Re: Getting a thread's state and CPU utilization
From: Dennis Jones
Date: Sun, 14 Jan 2007 17:25
Date: Sun, 14 Jan 2007 17:25
27 lines
2021 bytes
2021 bytes
"Dennis Jones" <nospam@nospam.com> wrote in message news:45aa5fbf$1@newsgroups.borland.com... > > "Bob Gonder" <notbg@notmindspring.invalid> wrote in message > news:999kq2l4vmj0mq60qde1gvpcom1l4arf8a@4ax.com... >> Dennis Jones wrote: >> >>>Does anyone know if there is a way to determine the state of a currently >>>running thread? >>> I'd like to be able to find out if a thread is executing, terminated, >> >> GetExitCodeThread() >> >> or check the signal status of the thread handle. >> >> WaitForSingleObject( hThread, 0 ) > > Thanks, this gives a pretty generic result, but it might be all I need. On second thought, that won't work. WaitForSingleObject wants the handle of an object to wait on, and for threads, the handle is only signaled when the 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). - Dennis
Technical Details
Message-ID:
<45aa675f$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<45a9e77e$1@newsgroups.borland.com> <999kq2l4vmj0mq60qde1gvpcom1l4arf8a@4ax.com> <45aa5fbf$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> Subject: Re: Getting a thread's state and CPU utilization Date: Sun, 14 Jan 2007 09:25:05 -0800 Lines: 29 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: <45aa675f$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1168795487 71.245.109.58 (14 Jan 2007 09:24:47 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail