LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-28-2004, 10:56 AM   #1
Linh
Member
 
Registered: Apr 2003
Posts: 178

Rep: Reputation: 30
Is the wait function is the same as the sleep function ?


Is the wait function is the same as the sleep function ?

--------------------------------------------------------------------

Is the wait function in C
is the same as the sleep function in BASH ?

I ran the program below, and it does not seemed that the
wait function is activated because the print statement
printf ("Not in the while loop\n"); print right away, and there was not any delay.
==========================
Code:
#include <stdio.h>

main()

  {
     int true = 1;
     while (true == 0)
        {
           printf ("IN THE WHILE LOOP\n");
        }
     wait(100000);
     printf ("Not in the while loop\n");
  }

Last edited by Linh; 04-28-2004 at 11:21 AM.
 
Old 04-28-2004, 11:01 AM   #2
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 31
Type: man wait and you will see that wait is not the same as sleep. (wait, waits for a thread to exit)
Type: man 3 sleep and you will see that C also has a sleep function defined in unistd.h

Last edited by deiussum; 04-28-2004 at 11:04 AM.
 
Old 04-28-2004, 11:20 AM   #3
Linh
Member
 
Registered: Apr 2003
Posts: 178

Original Poster
Rep: Reputation: 30
reply

Thank you deiussum for your help.
 
Old 04-28-2004, 12:39 PM   #4
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
LOL i answered ur question over at devshed a min ago
 
  


Reply


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
How to disable the Monitor Sleep function under RH9 ?? 242VDM242 Linux - Newbie 1 05-21-2005 01:51 PM
looking for a Sleep() function Mike Davies Linux - Software 2 10-25-2004 08:11 AM
wait( ) function usage, howto? feetyouwell Programming 5 09-21-2004 11:04 AM
A main can be changed by a function local without passing anything to the function? ananthbv Programming 10 05-04-2004 01:31 PM
help using rtc as a more accurate replacement for python's 'sleep' function kernelpanicguy Programming 0 11-29-2003 12:36 AM


All times are GMT -5. The time now is 11:57 PM.

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