Jump to content

looking for synonym to sleep() in C


Recommended Posts

Hey,

 

I am looking for a synonym of the sleep() function in C program that will cause the program to halt to a period of time, but won't shut the program down in the same way that sleep() does.

 

My teacher mentioned it and now I can't remember what it was.

 

Also, I trying to find a really good online C programming reference/community. Something that is aimed at newbies and pros alike. Any suggestions?

Link to comment
Share on other sites

what do you mean "won't shut the program down"? you may want to use the wait function look at man:/wait(2) in konq.

 

also for a higher resolution sleep look at nanosleep man:/nanosleep

 

take a look at this if you havent.

http://www.gnu.org/software/libc/manual/ht...node/index.html

Link to comment
Share on other sites

From what I remember from what my teacher said, sleep stops the program from responding to signals for the duration that it is asleep.

 

What I want to do is to create a little timer that will cause the program to stop for a second or two, but still respond to signals. I don't think I can do this with sleep.

 

I will look into the wait command.

 

The link looks great, thanks.

Link to comment
Share on other sites

GetTimeOfDay() or something like that? I don't know, I don't use delays unless I'm only testing things. I just use time-based movement and such things as that. And since I use SDL because I'm doing games, I have access to SDL_Delay(), which does sorta what sleep() does I think...

 

Anyhow, cprogramming.com is a decent forum and stuff, IMHO. But I'd like to build on this one here... No reason why not to, right? :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...