Replacement code for Threading.Thread.Sleep

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.
 
M

Mattias Sjögren

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
 
S

Sam

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.
 
P

Patrice

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...
 
S

Sam

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.
 
S

Sam

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.
 
S

Sam

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.
 
S

Sam

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.
 
P

Patrice

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top