Article View: borland.public.cppbuilder.nativeapi
Article #11461Re: Sleep time resolution
From: Malcolm Smith
Date: Thu, 12 Feb 2004 12:17
Date: Thu, 12 Feb 2004 12:17
29 lines
1937 bytes
1937 bytes
I made an observation a long time ago that Sleep(0) causes real problems in tight loops. Change it to Sleep(1) - all problems go away. Alternatively, my FREE MJFPack has a multimedia timer component that gives very high resolution. -- --- Malcolm Smith MJ Freelancing http://www.mjfreelancing.com Borland Technology Partner "Detlef" <detlef.stute@seatec-gmbh.com> wrote in message news:402b4f78$1@newsgroups.borland.com... > Hi all, > I'm using Win2K and like to communicate with a digital IO card with a > frequence of 200 Hz. I'm using a thread to send data to the card. > The problem is that windows supports only sleep timeslices of 10/15 ms ( > depending on processor) or Sleep(0). > If I use Sleep( 0) my process uses a lot of processor time. > > Is there a way to create events or sleeps with a resolution of 5 milli > seconds with an accuracy of +/- 1 milli second? > > Detlef > >
Technical Details
Message-ID:
<402b6ed2$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<402b4f78$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,3e6954a6a5dc7821 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-02-12 04:24:49 PST Reply-To: "Malcolm Smith" <mjfreelancing@optusnet.com.au> From: "Malcolm Smith" <mjfreelancing@optusnet.com.au> Newsgroups: borland.public.cppbuilder.nativeapi References: <402b4f78$1@newsgroups.borland.com> Subject: Re: Sleep time resolution Date: Thu, 12 Feb 2004 23:17:31 +1100 Lines: 31 Organization: MJ Freelancing 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: 211.30.147.112 Message-ID: <402b6ed2$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1076588242 211.30.147.112 (12 Feb 2004 04:17:22 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail