🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #14339

Re: Calling Sleep function from an application multithread

#14339
From: Rob
Date: Sun, 17 Aug 2003 11:47
23 lines
2026 bytes
"Antonio Farfan" <amfm0777@hotmail.com> wrote in message
news:3f3bb174@newsgroups.borland.com...
> I suppose that a call to function Sleep in an application multihread from
a
> thread could generate that this thread is not wake up by the Scheduler of
> o.s.
> My ask is if there are any call more safe that this sleep.
>

Depends what you mean by "safe".

Sleep(0) is the recommended approach for a thread to explicitly yield it's
timeslice, so that the OS scheduler can allow other threads to execute
in that time slice.

Sleep(milliseconds) causes the thread to yield it's timeslice, and not
continue executing for the specified period.  That is safe, in the sense
that execution is guaranteed to continue.   It is not safe, in the sense
that
execution is not guaranteed to continue after exactly the period
specified.   Windows does not provide that guarantee;  if you need
that guarantee, you will need to use a realtime operating system
(eg VxWorks, LynxOs, Integrity).
Technical Details
Message-ID: <3f3f6c88@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!skynet.be!skynet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f3bb174@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,cae0500b27212399
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-08-17 04:53:44 PST
From: "Rob" <nospam@nonexistant.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f3bb174@newsgroups.borland.com>
Subject: Re: Calling Sleep function from an application multithread
Date: Sun, 17 Aug 2003 21:17:24 +0930
Lines: 26
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.118.115
Message-ID: <3f3f6c88@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1061121160 211.26.118.115 (17 Aug 2003 04:52:40 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!skynet.be!skynet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail