Article View: borland.public.cppbuilder.nativeapi
Article #14904Re: GetCurrentProcessId(),GetCurrentThreadId() ?
From: Rob
Date: Sat, 26 Jul 2003 05:25
Date: Sat, 26 Jul 2003 05:25
31 lines
2196 bytes
2196 bytes
"CC" <Xcurtc@tmscorp.com> wrote in message news:3f215d5e@newsgroups.borland.com... > > Greetings I have a server that uses TThreads to service clients. > > Each thread logs debug info, and prints result from GetCurrentProcessId() > and GetCurrentThreadId() as part of debug info. > > My goal is to have each line tagged wih thread id, that way if I want to > view messages from just on thread, > I can filter by one thread id. > > The function which does the logging is not part of the thread, but just a > regular function call, not a member of any class. > > The problem is I'm getting the same process and thread ID for all messages > for both threads (process id expected the same, i expected to get thread id > different). > > Any ideas on how I can get the unique TTHread's unique id? > The functions you describe should do it. I assume the function that does the logging synchronises access to the file it is writing to or any variables it accesses that are accessed by multiple threads. If you're not honouring that assumption, that may be a cause of your problems. It may help if you provide a small code example that illustrates the problem.
Technical Details
Message-ID:
<3f2211df$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f215d5e@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,7d819d0bb118e239 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-07-25 22:40:05 PST From: "Rob" <nospam@nonexistant.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f215d5e@newsgroups.borland.com> Subject: Re: GetCurrentProcessId(),GetCurrentThreadId() ? Date: Sat, 26 Jul 2003 14:55:30 +0930 Lines: 34 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: 211.26.115.139 Message-ID: <3f2211df$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1059197407 211.26.115.139 (25 Jul 2003 22:30:07 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail