How to "sleep" or "delay"?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    How to "sleep" or "delay"?

    Thanks.

    I am writing a C++ code on Linux and Sun OS platform.
    How to make a procedure sleep or delay?

    Thanks again.

    "John Carson" <donaldquixote@ datafast.net.au > wrote in message news:<40455261$ 1@usenet.per.pa radox.net.au>.. .[color=blue]
    > "John Carson" <donaldquixote@ datafast.net.au > wrote in message
    > news:40455214$1 @usenet.per.par adox.net.au[color=green]
    > > "John" <johnw822003@ya hoo.com> wrote in message
    > > news:c30e885a.0 403021908.31f49 9b5@posting.goo gle.com[color=darkred]
    > >> Hi all:
    > >>
    > >> Is there a function to make a procedure sleep or delay for a few
    > >> /seconds/minutes?
    > >>
    > >> Thanks a lot.[/color]
    > >
    > > Yes. It is called Sleep.[/color]
    >
    >
    >
    > My mistake. Forgot what newsgroup I was in. There is no standard C++
    > function to do this. It is platform specific.[/color]
  • Julie

    #2
    Re: How to &quot;sleep&quo t; or &quot;delay&quo t;?

    John wrote:[color=blue]
    >
    > Thanks.
    >
    > I am writing a C++ code on Linux and Sun OS platform.
    > How to make a procedure sleep or delay?
    >
    > Thanks again.
    >
    > "John Carson" <donaldquixote@ datafast.net.au > wrote in message news:<40455261$ 1@usenet.per.pa radox.net.au>.. .[color=green]
    > > "John Carson" <donaldquixote@ datafast.net.au > wrote in message
    > > news:40455214$1 @usenet.per.par adox.net.au[color=darkred]
    > > > "John" <johnw822003@ya hoo.com> wrote in message
    > > > news:c30e885a.0 403021908.31f49 9b5@posting.goo gle.com
    > > >> Hi all:
    > > >>
    > > >> Is there a function to make a procedure sleep or delay for a few
    > > >> /seconds/minutes?
    > > >>
    > > >> Thanks a lot.
    > > >
    > > > Yes. It is called Sleep.[/color]
    > >
    > >
    > >
    > > My mistake. Forgot what newsgroup I was in. There is no standard C++
    > > function to do this. It is platform specific.[/color][/color]

    If you are looking for a platform-specific solution, you will need to post your
    question in a newsgroup that responds to platform-specific posts.

    I posted a platform-neutral version in response to your first inquiry. Any
    particular reason that won't work for you?

    Comment

    • John

      #3
      Re: How to &quot;sleep&quo t; or &quot;delay&quo t;?

      Thanks. I just read it. Due to the up to 9 hours delay of posting, I
      post my question before I saw your response. :-)

      John

      Julie <julie@aol.co m> wrote in message news:<4045801E. F3C5B881@aol.co m>...[color=blue]
      > John wrote:[color=green]
      > >
      > > Thanks.
      > >
      > > I am writing a C++ code on Linux and Sun OS platform.
      > > How to make a procedure sleep or delay?
      > >
      > > Thanks again.
      > >
      > > "John Carson" <donaldquixote@ datafast.net.au > wrote in message news:<40455261$ 1@usenet.per.pa radox.net.au>.. .[color=darkred]
      > > > "John Carson" <donaldquixote@ datafast.net.au > wrote in message
      > > > news:40455214$1 @usenet.per.par adox.net.au
      > > > > "John" <johnw822003@ya hoo.com> wrote in message
      > > > > news:c30e885a.0 403021908.31f49 9b5@posting.goo gle.com
      > > > >> Hi all:
      > > > >>
      > > > >> Is there a function to make a procedure sleep or delay for a few
      > > > >> /seconds/minutes?
      > > > >>
      > > > >> Thanks a lot.
      > > > >
      > > > > Yes. It is called Sleep.
      > > >
      > > >
      > > >
      > > > My mistake. Forgot what newsgroup I was in. There is no standard C++
      > > > function to do this. It is platform specific.[/color][/color]
      >
      > If you are looking for a platform-specific solution, you will need to post your
      > question in a newsgroup that responds to platform-specific posts.
      >
      > I posted a platform-neutral version in response to your first inquiry. Any
      > particular reason that won't work for you?[/color]

      Comment

      • John Carson

        #4
        Re: How to &quot;sleep&quo t; or &quot;delay&quo t;?

        "Julie" <julie@aol.co m> wrote in message news:4045801E.F 3C5B881@aol.com[color=blue]
        >
        > I posted a platform-neutral version in response to your first
        > inquiry. Any particular reason that won't work for you?[/color]

        (The other) John seems happy, but your solution will drive CPU usage up to
        100% (it does on Windows anyway), just so the program can do nothing.
        Personally, I would much prefer a platform specific solution that actually
        puts the thread to sleep.


        --
        John Carson
        1. To reply to email address, remove donald
        2. Don't reply to email address (post here instead)

        Comment

        • Jorge Rivera

          #5
          Re: How to &quot;sleep&quo t; or &quot;delay&quo t;?

          John Carson wrote:[color=blue]
          > "Julie" <julie@aol.co m> wrote in message news:4045801E.F 3C5B881@aol.com
          >[color=green]
          >>I posted a platform-neutral version in response to your first
          >>inquiry. Any particular reason that won't work for you?[/color]
          >
          >
          > (The other) John seems happy, but your solution will drive CPU usage up to
          > 100% (it does on Windows anyway), just so the program can do nothing.
          > Personally, I would much prefer a platform specific solution that actually
          > puts the thread to sleep.
          >
          >[/color]

          I can't remember all the details, but I beleive that you can set an
          "alarm" (look in the signals documentationon your Unix implementation) .
          Also, there is nanosleep. All you have to do is convert your time to
          the appropriate nanosleep compatible time structure, and you will sleep
          for that amount of nanoseconds.

          JLR

          Comment

          • Julie

            #6
            Re: How to &quot;sleep&quo t; or &quot;delay&quo t;?

            Jorge Rivera wrote:[color=blue]
            >
            > John Carson wrote:[color=green]
            > > "Julie" <julie@aol.co m> wrote in message news:4045801E.F 3C5B881@aol.com
            > >[color=darkred]
            > >>I posted a platform-neutral version in response to your first
            > >>inquiry. Any particular reason that won't work for you?[/color]
            > >
            > >
            > > (The other) John seems happy, but your solution will drive CPU usage up to
            > > 100% (it does on Windows anyway), just so the program can do nothing.
            > > Personally, I would much prefer a platform specific solution that actually
            > > puts the thread to sleep.
            > >
            > >[/color]
            >
            > I can't remember all the details, but I beleive that you can set an
            > "alarm" (look in the signals documentationon your Unix implementation) .
            > Also, there is nanosleep. All you have to do is convert your time to
            > the appropriate nanosleep compatible time structure, and you will sleep
            > for that amount of nanoseconds.
            >
            > JLR[/color]

            Yes, but that isn't platform neutral and/or portable.

            The OP requested a way to sleep using standard C++ which is what I provided.

            Comment

            • Julie

              #7
              Re: How to &quot;sleep&quo t; or &quot;delay&quo t;?

              Julie wrote:[color=blue]
              >
              > Jorge Rivera wrote:[color=green]
              > >
              > > John Carson wrote:[color=darkred]
              > > > "Julie" <julie@aol.co m> wrote in message news:4045801E.F 3C5B881@aol.com
              > > >
              > > >>I posted a platform-neutral version in response to your first
              > > >>inquiry. Any particular reason that won't work for you?
              > > >
              > > >
              > > > (The other) John seems happy, but your solution will drive CPU usage up to
              > > > 100% (it does on Windows anyway), just so the program can do nothing.
              > > > Personally, I would much prefer a platform specific solution that actually
              > > > puts the thread to sleep.
              > > >
              > > >[/color]
              > >
              > > I can't remember all the details, but I beleive that you can set an
              > > "alarm" (look in the signals documentationon your Unix implementation) .
              > > Also, there is nanosleep. All you have to do is convert your time to
              > > the appropriate nanosleep compatible time structure, and you will sleep
              > > for that amount of nanoseconds.
              > >
              > > JLR[/color]
              >
              > Yes, but that isn't platform neutral and/or portable.
              >
              > The OP requested a way to sleep using standard C++ which is what I provided.[/color]

              That last line should read:

              The OP originally requested a way to sleep using standard C++ which is what I
              provided. Platform-specific solutions should be discussed in the relevant
              newsgroup(s), not clc++.

              Comment

              • John Carson

                #8
                Re: How to &quot;sleep&quo t; or &quot;delay&quo t;?

                "Julie" <julie@aol.co m> wrote in message news:40469853.D C409461@aol.com[color=blue]
                > Julie wrote:
                >
                > The OP originally requested a way to sleep using standard C++ which
                > is what I provided. Platform-specific solutions should be discussed
                > in the relevant newsgroup(s), not clc++.[/color]

                Actually, he made no reference to standard C++, though perhaps you inferred
                this from the newsgroup he chose to post in. I agree with your second
                sentence. But I don't believe in using standard solutions that are not good
                solutions.


                --
                John Carson
                1. To reply to email address, remove donald
                2. Don't reply to email address (post here instead)

                Comment

                Working...