Visit the LQ Articles and Editorials section
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-16-2009, 01:49 AM   #1
LQ Newbie
Registered: Jul 2008
Posts: 3

Rep: Reputation: 0
Sleep indefinitely

Hello all,

I am new to the Linux world. I have a small query. I have written a C program, wherein, I want to sleep/wait for ever in one of the function calls.

I had used sleep(-1) for that. I could have used something like,
But, with while(1) cpu resources would continue to be used.

I am not sure if that is correct to use sleep(-1) or there are better ways of doing this. Can you guys please suggest?

Thank you
Old 02-16-2009, 04:37 AM   #2
LQ Newbie
Registered: Apr 2008
Location: Hampshire, UK
Distribution: None
Posts: 27

Rep: Reputation: 16
Maybe you could put the two together?
while ( 1 )



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Server randomly hangs indefinitely bdb4269 Linux - General 2 03-07-2008 02:24 PM
How do I pause a thread indefinitely and then resume it again (in Java)? Nylex Programming 7 02-18-2007 01:13 PM
LXer: Free EHR Software from HHS Delayed Indefinitely LXer Syndicated Linux News 0 07-01-2006 11:33 PM
Searching for Server (BOOTP/DHCP) <sleep> <sleep> .. .. Eileen Linux - Networking 12 10-21-2005 02:14 AM
logrotate takes up 100% CPU indefinitely BroX Slackware 2 05-24-2005 04:32 AM

All times are GMT -5. The time now is 05:37 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration