Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Take a Nap

Take a Nap

Scheduled Pinned Locked Moved The Weird and The Wonderful
rubydata-structures
10 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Chris Meech
    wrote on last edited by
    #1

    Sometimes I shake my head. Found this gem in some stuff I wrote 7 or 8 years ago.

    Sleep(15); // Just Sleep to block the thread and the message queue will clear. (crosses fingers :) )

    I especially like the smiley in the comment. :doh:

    Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]

    F T G G 4 Replies Last reply
    0
    • C Chris Meech

      Sometimes I shake my head. Found this gem in some stuff I wrote 7 or 8 years ago.

      Sleep(15); // Just Sleep to block the thread and the message queue will clear. (crosses fingers :) )

      I especially like the smiley in the comment. :doh:

      Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]

      F Offline
      F Offline
      fjdiewornncalwe
      wrote on last edited by
      #2

      But it does sound like a splendid idea right now

      1 Reply Last reply
      0
      • C Chris Meech

        Sometimes I shake my head. Found this gem in some stuff I wrote 7 or 8 years ago.

        Sleep(15); // Just Sleep to block the thread and the message queue will clear. (crosses fingers :) )

        I especially like the smiley in the comment. :doh:

        Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]

        T Offline
        T Offline
        The Man from U N C L E
        wrote on last edited by
        #3

        I saw similar code recently, stuff running on another thread at the time. It all worked wonderfully until someone ran it from an old, slow, low memory machine where the wait wasn't long enough! Now where is the GoBackToSleepABitMore() command? It works on my kids. :laugh:

        If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]

        F 1 Reply Last reply
        0
        • T The Man from U N C L E

          I saw similar code recently, stuff running on another thread at the time. It all worked wonderfully until someone ran it from an old, slow, low memory machine where the wait wasn't long enough! Now where is the GoBackToSleepABitMore() command? It works on my kids. :laugh:

          If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]

          F Offline
          F Offline
          fjdiewornncalwe
          wrote on last edited by
          #4

          Really.. You have to teach me that one. Mine get up at 6:00AM on weekends, even if I make it impossible for them to watch cartoons or play video games.

          T 1 Reply Last reply
          0
          • C Chris Meech

            Sometimes I shake my head. Found this gem in some stuff I wrote 7 or 8 years ago.

            Sleep(15); // Just Sleep to block the thread and the message queue will clear. (crosses fingers :) )

            I especially like the smiley in the comment. :doh:

            Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]

            G Offline
            G Offline
            Graham Cottle
            wrote on last edited by
            #5

            Hmmm. Did something similar a while ago when I wrote my first multithreading application. It was getting three datasets from a database and needed all three to finish before moving on. Initially, I had the sleep before I got the threads to synchronise properly. However, I forgot to take the sleep out. Application went into Production and only after a complaint a few months later did I investigate and find the gem. Good thing was that I looked like a hero because I made the application so much quicker. One of these days I'll own up!

            C 1 Reply Last reply
            0
            • F fjdiewornncalwe

              Really.. You have to teach me that one. Mine get up at 6:00AM on weekends, even if I make it impossible for them to watch cartoons or play video games.

              T Offline
              T Offline
              The Man from U N C L E
              wrote on last edited by
              #6

              keep them up late on friday night usually works. of course you don't get enough sleep either way!

              If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]

              1 Reply Last reply
              0
              • G Graham Cottle

                Hmmm. Did something similar a while ago when I wrote my first multithreading application. It was getting three datasets from a database and needed all three to finish before moving on. Initially, I had the sleep before I got the threads to synchronise properly. However, I forgot to take the sleep out. Application went into Production and only after a complaint a few months later did I investigate and find the gem. Good thing was that I looked like a hero because I made the application so much quicker. One of these days I'll own up!

                C Offline
                C Offline
                Chris Meech
                wrote on last edited by
                #7

                Nah, those are the things we build our reputations on. :)

                Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]

                1 Reply Last reply
                0
                • C Chris Meech

                  Sometimes I shake my head. Found this gem in some stuff I wrote 7 or 8 years ago.

                  Sleep(15); // Just Sleep to block the thread and the message queue will clear. (crosses fingers :) )

                  I especially like the smiley in the comment. :doh:

                  Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]

                  G Offline
                  G Offline
                  Gary Wheeler
                  wrote on last edited by
                  #8

                  I had an occasion where Sleep() was required to make something work. We had a third-party library we used to communicate with some USB hardware. The library didn't synchronize properly with the device driver, so you had to follow your calls to the library with Sleep() calls of various durations X| .

                  Software Zen: delete this;

                  G P 2 Replies Last reply
                  0
                  • G Gary Wheeler

                    I had an occasion where Sleep() was required to make something work. We had a third-party library we used to communicate with some USB hardware. The library didn't synchronize properly with the device driver, so you had to follow your calls to the library with Sleep() calls of various durations X| .

                    Software Zen: delete this;

                    G Offline
                    G Offline
                    ghle
                    wrote on last edited by
                    #9

                    Gary Wheeler wrote:

                    The library didn't synchronize properly with the device driver, so you had to follow your calls to the library with Sleep() calls of various durations.

                    Hmmm, (pondering whether this Sleep() will fix a BlueTooth sync problem we're experiencing....) :doh:

                    Gary

                    1 Reply Last reply
                    0
                    • G Gary Wheeler

                      I had an occasion where Sleep() was required to make something work. We had a third-party library we used to communicate with some USB hardware. The library didn't synchronize properly with the device driver, so you had to follow your calls to the library with Sleep() calls of various durations X| .

                      Software Zen: delete this;

                      P Offline
                      P Offline
                      Peter_in_2780
                      wrote on last edited by
                      #10

                      [Showing my age!] I remember back when the PC AT came out, with a (WOW!) 80286 clocked at 6 Mhz. You had to write two NOPs after every OUT instruction, I think it was. Otherwise the I/O bus got its tits in a tangle.

                      Software rusts. Simon Stephenson, ca 1994.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups