Replacement code for Threading.Thread.Sleep

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

    #1

    Replacement code for Threading.Thread.Sleep

    Hello everyone,
    Can anyone provide me some idea on how to replace the Sleep method.
    Major Disadvantage that I face with the Sleep method is that the
    application freezes and does not respond to any other events.

    I am looking for somedata on how to use Waitable Timer APIs with VB.NET

    Thanks in Advance.

  • Mattias Sjögren

    #2
    Re: Replacement code for Threading.Threa d.Sleep

    >Can anyone provide me some idea on how to replace the Sleep method.

    It would be easier to suggest a replacement if you tell us why are you
    sleeping/waiting to begin with?


    Mattias

    --
    Mattias Sjögren [C# MVP] mattias @ mvps.org
    http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
    Please reply only to the newsgroup.

    Comment

    • Sam

      #3
      Re: Replacement code for Threading.Threa d.Sleep

      Hello Mattias,

      The reason why the application needs to respond to events during sleep
      is because the application interacts with more than one Hardware unit.
      And sleep is necessary because there is a delay between when the
      application request for data and when the actual data is received back
      from the hardware.

      Please refer to the following newsgroup question for more details about
      Waitable Timer class of VB.


      Please let me know if you need further information.

      Thanks for offering help.

      Comment

      • Patrice

        #4
        Re: Replacement code for Threading.Threa d.Sleep

        And the API for accessing this "hardware" doesn't have events or
        asynchronous call support ? Would be a bit strange for something that must
        wait before responding...

        --
        Patrice

        "Sam" <indianmostwant ed@yahoo.com> a écrit dans le message de news:
        1145464117.5272 33.38840@i39g20 00...legro ups.com...[color=blue]
        > Hello Mattias,
        >
        > The reason why the application needs to respond to events during sleep
        > is because the application interacts with more than one Hardware unit.
        > And sleep is necessary because there is a delay between when the
        > application request for data and when the actual data is received back
        > from the hardware.
        >
        > Please refer to the following newsgroup question for more details about
        > Waitable Timer class of VB.
        > http://groups.google.com/group/micro...963709a1ee9f8e
        >
        > Please let me know if you need further information.
        >
        > Thanks for offering help.
        >[/color]


        Comment

        • Sam

          #5
          Re: Replacement code for Threading.Threa d.Sleep

          Hello Patrice,
          Even though the hardware's API supports events, the software doesnot
          give access to the application to respond to the event. I have been
          using Application.DoE vents() to give control to the event to occur.
          Sometimes it works, other times it doesnt.

          Thanks.

          Comment

          • Sam

            #6
            Re: Replacement code for Threading.Threa d.Sleep

            Hello Patrice,
            Even though the hardware's API supports events, the software doesnot
            give access to the application to respond to the event. I have been
            using Application.DoE vents() to give control to the event to occur.
            Sometimes it works, other times it doesnt.

            Thanks.

            Comment

            • Sam

              #7
              Re: Replacement code for Threading.Threa d.Sleep

              Hello Patrice,
              Even though the hardware's API supports events, the software doesnot
              give access to the application to respond to the event. I have been
              using Application.DoE vents() to give control to the event to occur.
              Sometimes it works, other times it doesnt.

              Comment

              • Sam

                #8
                Re: Replacement code for Threading.Threa d.Sleep

                Hello Patrice,
                Even though the hardware's API supports events, the software doesnot
                give access to the application to respond to the event. I have been
                using Application.DoE vents() to give control to the event to occur.
                Sometimes it works, other times it doesnt.

                Comment

                • Patrice

                  #9
                  Re: Replacement code for Threading.Threa d.Sleep

                  You could perhaps launch this on another thread. This way this is not your
                  UI thread that would sleep.

                  A bit hard to help as I don't know about this hardware (what is this ?). Do
                  you have some way of knowing for sure that data are available ? The hardware
                  vendor doesn't have code samples ?

                  Good luck.

                  --
                  Patrice

                  "Sam" <indianmostwant ed@yahoo.com> a écrit dans le message de news:
                  1145632998.4875 72.295410@t31g2 00...legr oups.com...[color=blue]
                  > Hello Patrice,
                  > Even though the hardware's API supports events, the software doesnot
                  > give access to the application to respond to the event. I have been
                  > using Application.DoE vents() to give control to the event to occur.
                  > Sometimes it works, other times it doesnt.
                  >
                  > Thanks.
                  >[/color]


                  Comment

                  Working...