473,386 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

sleep()

For the life of me, I thought there was a sleep() function in the Standard
Library (or something similarly named), but I can't find it. Is it
non-existent or, if not, what header is it in?

Thanks!

Dave
Jul 22 '05 #1
5 5513
Dave wrote:

For the life of me, I thought there was a sleep() function in the Standard
Library (or something similarly named), but I can't find it. Is it
non-existent or, if not, what header is it in?


There is no such thing.

--
Karl Heinz Buchegger
kb******@gascad.at
Jul 22 '05 #2
Dave <be***********@yahoo.com> spoke thus:
For the life of me, I thought there was a sleep() function in the Standard
Library (or something similarly named), but I can't find it. Is it
non-existent or, if not, what header is it in?


It isn't standard C - it's POSIX, I believe, which is not the same
thing.

http://www.ungerhu.com/jxh/clc.welcome.txt
http://www.eskimo.com/~scs/C-faq/top.html
http://benpfaff.org/writings/clc/off-topic.html

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jul 22 '05 #3
"Dave" <be***********@yahoo.com> wrote in message
news:10*************@news.supernews.com...
For the life of me, I thought there was a sleep() function in the Standard
Library (or something similarly named), but I can't find it. Is it
non-existent or, if not, what header is it in?

There is not the concept of threads in C++98. It is considered a system
extension. You have to check the manual of your compiler.


Ioannis Vranos

Jul 22 '05 #4
Dave wrote:
For the life of me, I thought there was a sleep() function
in the Standard Library (or something similarly named),
but I can't find it.
Is it non-existent or, if not, what header is it in?


SLEEP(3) Linux Programmer’s Manual SLEEP(3)

NAME
sleep - Sleep for the specified number of seconds

SYNOPSIS
#include <unistd.h>

unsigned int sleep(unsigned int seconds);

DESCRIPTION
sleep() makes the current process sleep until seconds seconds
have elapsed or a signal arrives which is not ignored.

RETURN VALUE
Zero if the requested time has elapsed,
or the number of seconds left to sleep.

CONFORMING TO
POSIX.1

BUGS
sleep() may be implemented using SIGALRM;
mixing calls to alarm() and sleep() is a bad idea.

Using longjmp() from a signal handler or modifying the handling
of SIGALRM while sleeping will cause undefined results.

SEE ALSO
signal(2), alarm(2)

GNU 1993-04-07 SLEEP(3)

Jul 22 '05 #5
In message <c5**********@ulysses.noc.ntua.gr>, Ioannis Vranos
<iv*@guesswh.at.emails.ru> writes
"Dave" <be***********@yahoo.com> wrote in message
news:10*************@news.supernews.com...
For the life of me, I thought there was a sleep() function in the Standard
Library (or something similarly named), but I can't find it. Is it
non-existent or, if not, what header is it in?

There is not the concept of threads in C++98. It is considered a system
extension. You have to check the manual of your compiler.


True, but what has that to do with the (equally non-standard,
hypothetical) sleep() function?

--
Richard Herring
Jul 22 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Anks | last post by:
hi I am displaying a digital clock in an applet.I am using Thread.sleep (1000) for counting every second.This works fine some times but some times my clock just slows down or give an...
7
by: Colin Brown | last post by:
Python 2.3.3 Under Windows NT: Negative Int or Real -> sleeps for a long time Under Linux: Returns IOError: Invalid argument I consider both of these unfriendly results and expected the...
21
by: Alo Sarv | last post by:
Hi From what I have understood from various posts in this newsgroup, writing event loops pretty much comes down to this: while (true) { handleEvents(); sleep(1); // or _sleep() or...
8
by: Cider123 | last post by:
I ran into a situation where my Window Service had to process 100,000+ files, when I first noticed I needed to tweak various routines. Everything runs fine, but here's what I ran into: In the...
9
by: Chris Dunaway | last post by:
According to the docs, calling Thread.Sleep(0) causes the thread to be "suspended to allow other waiting threads to execute." What happens if I call Thread.Sleep(500)? Do other threads not get a...
17
by: OlafMeding | last post by:
Below are 2 files that isolate the problem. Note, both programs hang (stop responding) with hyper-threading turned on (a BIOS setting), but work as expected with hyper-threading turned off. ...
1
by: Matt Brown - identify | last post by:
Hello, I, as well as suspecting many others, am having an issue when I attempt to enter sleep mode in Vista. If any program is connected to the internet (AOL Instant Messenger for instance),...
13
by: Charles Zhang | last post by:
Sleep() function Sleep at lease 1 millisecond, there is a way to make a thread to sleep less than a millisecond? One way I know of is using performance counter which is not really sleep ( loop and...
0
by: Tim Golden | last post by:
Lowell Alleman wrote: Well you've certainly picked a ticklish area to run into problems with ;). First, forget about the threading aspects for the moment. AFAICT the smallest program which...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.