🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #692

Re: Using a timer to "sleep"

#692
From: Ed Schwalenberg
Date: Fri, 23 Nov 1990 19:23
22 lines
1239 bytes
In article <karel.659135309@prisma> karel@prisma.cv.ruu.nl (Karel Zuiderveld) writes:

  In <13796@june.cs.washington.edu> goble@wolf.cs.washington.edu (Brian Goble) writes:

  >Is there a windows function or an MS C
  >function (like Turbo C's "sleep()") that will do a delay?
  >

  VOID FAR PASCAL wsleep(int iNrSeconds)
  {
      DWORD lCountStop = GetTickCount() + 1000L * (DWORD) iNrSeconds;

      while (GetTickCount() < lCountStop);
  }

  Of course there is one but with this approach: all CPU power is spend
  in that loop. 

while (GetTickCount() < lCountStop) Yield();
lets other Windows processes run while you're sleeping.  Even better is
to integrate the sleepiness with your program's message loop; see the
documentation on PeekMessage.
Technical Details
Message-ID: <1990Nov23.192305.4711@odi.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!odi!ed
References: <13796@june.cs.washington.edu> <karel.659135309@prisma>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!odi!ed
From: ed@odi.com (Ed Schwalenberg)
Newsgroups: comp.windows.ms.programmer
Subject: Re: Using a timer to "sleep"
Message-ID: <1990Nov23.192305.4711@odi.com>
Date: 23 Nov 90 19:23:05 GMT
References: <13796@june.cs.washington.edu> <karel.659135309@prisma>
Organization: Object Design, Inc.
Lines: 22
In-Reply-To: karel@prisma.cv.ruu.nl's message of 20 Nov 90 21:08:29 GMT