Good wait function?

Discussion in 'C Programming' started by ern, Sep 27, 2005.

  1. ern

    ern Guest

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

    ie...

    void Wait(int milliseconds){
    //wait somehow
    }
    ern, Sep 27, 2005
    #1
    1. Advertising

  2. ern

    Eric Sosman Guest

    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

    --
    Eric Sosman, Sep 27, 2005
    #2
    1. Advertising

  3. ern

    Michael Mair Guest

    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.
    Michael Mair, Sep 27, 2005
    #3
  4. ern

    ern Guest

    I'm running Linux Red Hat, using gcc if anyone knows how to do it
    there. Thanks.
    ern, Sep 27, 2005
    #4
  5. "ern" <> 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) <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.
    Keith Thompson, Sep 28, 2005
    #5
  6. ern

    wilsonidv Guest

    ern 寫é“:

    > Anybody know a good function that waits a specified amount of
    > milliseconds?
    >
    > ie...
    >
    > void Wait(int milliseconds){
    > //wait somehow
    > }


    try select().
    wilsonidv, Sep 28, 2005
    #6
  7. ern

    Flash Gordon Guest

    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.
    Flash Gordon, Sep 28, 2005
    #7
  8. ern

    Skarmander Guest

    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.
    Skarmander, Sep 28, 2005
    #8
  9. ern

    Flash Gordon Guest

    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.
    Flash Gordon, Sep 28, 2005
    #9
  10. ern

    Skarmander Guest

    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.
    Skarmander, Sep 28, 2005
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. kuldeepiitk

    Wait function

    kuldeepiitk, Jun 21, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    7,278
    M. Zeeshan Mustafa
    Jun 21, 2004
  2. Huey

    How to make "fork/wait" to WAIT longer?

    Huey, Mar 1, 2004, in forum: C Programming
    Replies:
    1
    Views:
    1,958
    -berlin.de
    Mar 1, 2004
  3. pacopyc

    max time wait for a function

    pacopyc, May 18, 2010, in forum: Python
    Replies:
    3
    Views:
    362
    Terry Reedy
    May 18, 2010
  4. GTi

    Wait Window function

    GTi, Oct 25, 2003, in forum: Javascript
    Replies:
    4
    Views:
    190
    Thomas 'PointedEars' Lahn
    Oct 25, 2003
  5. Rasmus Grøndahl Olsen

    whats wrong with this wait function?

    Rasmus Grøndahl Olsen, Oct 27, 2003, in forum: Javascript
    Replies:
    2
    Views:
    83
    Evertjan.
    Oct 27, 2003
Loading...

Share This Page