Article View: borland.public.cppbuilder.nativeapi
Article #16187Re: TThread with messages
From: Remy Lebeau (TeamB)
Date: Sun, 25 May 2003 23:57
Date: Sun, 25 May 2003 23:57
16 lines
1687 bytes
1687 bytes
"Lapo" <lapoguidi@inwind.it> wrote in message news:3ed1434d@newsgroups.borland.com... > Using "while" loops the CPU is busy at 99% (checked > using TaskManager) and all the other applications > work like a snail. By running in a tight loop, you aren't allowing your thread to yield control back to the CPU so it can give time to other threads which are waiting. Put a call to Sleep() inside your loop to make it pause and yield control periodically. You don't need to use a large timeout, using something as small as 1-10 milliseconds will do fine. Gambit
Technical Details
Message-ID:
<3ed157dd$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3ed00a13@newsgroups.borland.com> <3ed01446$1@newsgroups.borland.com> <3ed0adcc$1@newsgroups.borland.com> <3ed13011@newsgroups.borland.com> <3ed1434d@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,9f6b69458a9a485d X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-05-25 16:58:31 PST From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3ed00a13@newsgroups.borland.com> <3ed01446$1@newsgroups.borland.com> <3ed0adcc$1@newsgroups.borland.com> <3ed13011@newsgroups.borland.com> <3ed1434d@newsgroups.borland.com> Subject: Re: TThread with messages Date: Sun, 25 May 2003 16:57:46 -0700 Lines: 18 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 207.175.226.26 Message-ID: <3ed157dd$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1053906909 207.175.226.26 (25 May 2003 16:55:09 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail