Replacement code for Threading.Thread.Sleep

  • Thread starter Thread starter Sam
  • Start date Start date
S

Sam

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.
 
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
 
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/micr...ait+Timer+class&rnum=1&hl=en#01963709a1ee9f8e

Please let me know if you need further information.

Thanks for offering help.
 
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...
 
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.DoEvents() to give control to the event to occur.
Sometimes it works, other times it doesnt.

Thanks.
 
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.DoEvents() to give control to the event to occur.
Sometimes it works, other times it doesnt.

Thanks.
 
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.DoEvents() to give control to the event to occur.
Sometimes it works, other times it doesnt.
 
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.DoEvents() to give control to the event to occur.
Sometimes it works, other times it doesnt.
 
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.
 
Back
Top