473,396 Members | 1,987 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,396 software developers and data experts.

Good wait function?

ern
Anybody know a good function that waits a specified amount of
milliseconds?

ie...

void Wait(int milliseconds){
//wait somehow
}

Nov 15 '05 #1
9 11373


ern wrote On 09/27/05 17:15,:
Anybody know a good function that waits a specified amount of
milliseconds?

ie...

void Wait(int milliseconds){
//wait somehow
}


This is Question 19.37 in the comp.lang.c Frequently
Asked Questions (FAQ) list

http://www.eskimo.com/~scs/C-faq/top.html

--
Er*********@sun.com

Nov 15 '05 #2
ern wrote:
Anybody know a good function that waits a specified amount of
milliseconds?

ie...

void Wait(int milliseconds){
//wait somehow
}


Define "good"...
If you mean "works on every platform/operating system/...", then
the answer is: There is none.
This is an area the C standard does not say much about. You
could try to abuse some of the functions prototyped in <time.h>
but this is not guaranteed to work.
It is even possible that your machine is not able to wait an
exactly specified amount of milliseconds because of, say, the
used multitasking modell.

See FAQ 19.37.

Ask in a newsgroup that deals with your platform/compiler/operating
system.
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Nov 15 '05 #3
ern
I'm running Linux Red Hat, using gcc if anyone knows how to do it
there. Thanks.

Nov 15 '05 #4
"ern" <er*******@gmail.com> writes:
I'm running Linux Red Hat, using gcc if anyone knows how to do it
there. Thanks.


Michael Mair has already given you the best answer you're going to get
in this newsgroup:

] See FAQ 19.37.
]
] Ask in a newsgroup that deals with your platform/compiler/operating
] system.

Try comp.unix.programming or something with "linux" in its name.

Also, please provide context when posting a followup.

If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.

Since you're on groups.google.com, you can see just how many times
this advice has been posted here. If you had browsed the newsgroup
before posting, you would have seen it already.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 15 '05 #5

ern 寫道:
Anybody know a good function that waits a specified amount of
milliseconds?

ie...

void Wait(int milliseconds){
//wait somehow
}


try select().

Nov 15 '05 #6
wilsonidv wrote:
ern 寫道:
Anybody know a good function that waits a specified amount of
milliseconds?

ie...

void Wait(int milliseconds){
//wait somehow
}


try select().


That is not part of the C standard and so may well not be available on
the OPs system, or if it is available might do something completely
different such as sellecting the target for a missile. Since the OP does
not specify a system you have no way of knowing.

We only discuss standard C, discussion of system specifics belong on the
groups dedicated to the relevant system and should be redirected to such
groups.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
Nov 15 '05 #7
Flash Gordon wrote:
wilsonidv wrote:
ern 寫道:
Anybody know a good function that waits a specified amount of
milliseconds?

ie...

void Wait(int milliseconds){
//wait somehow
}

try select().

That is not part of the C standard and so may well not be available on
the OPs system, or if it is available might do something completely
different such as sellecting the target for a missile. Since the OP does
not specify a system you have no way of knowing.

We only discuss standard C, discussion of system specifics belong on the
groups dedicated to the relevant system and should be redirected to such
groups.


Quite right. He should have said "try select(), for POSIX systems".

S.
Nov 15 '05 #8
Skarmander wrote:
Flash Gordon wrote:


<snip>
We only discuss standard C, discussion of system specifics belong on
the groups dedicated to the relevant system and should be redirected
to such groups.


Quite right. He should have said "try select(), for POSIX systems".


Had he done, he should also have redirected the OP to an appropriate
group for further discussion and said that he was suggesting a system
specific solution because there is no solution within standard C.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
Nov 15 '05 #9
Flash Gordon wrote:
Skarmander wrote:
Flash Gordon wrote:

<snip>
We only discuss standard C, discussion of system specifics belong on
the groups dedicated to the relevant system and should be redirected
to such groups.

Quite right. He should have said "try select(), for POSIX systems".

Had he done, he should also have redirected the OP to an appropriate
group for further discussion and said that he was suggesting a system
specific solution because there is no solution within standard C.


Yeah, yeah. But that had already been taken care of elsethreadwhere.

S.
Nov 15 '05 #10

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

Similar topics

10
by: KN | last post by:
I know both are pretty much the same and it comes down to personal choice. But I have to make the choice for the team. Things so far that I am considering 1. XML documentation in C# -- thats...
2
by: Rasmus Grndahl Olsen | last post by:
I have tried to write a wait function but it seems like it will not brake the while loop. I tried two different solutions. Can anyone tell me what I am doing wrong, and come with another...
6
by: SP | last post by:
Hi, I want to add wait cursor code whenever page is post back. Page may be post back on my user control's or on change of dropdown or on click of any button on page. so is there any common...
12
by: shafiqrao | last post by:
Hello everyone, I have a script that runs in IE great, but in firefox it has problems. I understand that there are some objects that are accessed differently in IE and Mozilla. Can anybody let...
12
by: Perecli Manole | last post by:
I am having some strange thread synchronization problems that require me to better understand the intricacies of Monitor.Wait/Pulse. I have 3 threads. Thread 1 does a Monitor.Wait in a SyncLock...
14
by: stephen.durkin | last post by:
I've gathered that javascript doesn't have a handy wait() function, so I made the following function makeDelay() to make use of PHP's sleep(), which then does the waiting, and responds with...
4
by: MrDeej | last post by:
Hello guys! I am trying to use trevors wait function on my odbc database for a countdown function. But this function is not stable as it sometimes dosent actually wait before launching next line...
206
by: WaterWalk | last post by:
I've just read an article "Building Robust System" by Gerald Jay Sussman. The article is here: http://swiss.csail.mit.edu/classes/symbolic/spring07/readings/robust-systems.pdf In it there is a...
18
by: David Moss | last post by:
Hi, I want to manage and control access to several important attributes in a class and override the behaviour of some of them in various subclasses. Below is a stripped version of how I've...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...

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.