Home All Groups Group Topic Archive Search About

Replacement code for Threading.Thread.Sleep

Author
19 Apr 2006 3:52 PM
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.

Author
19 Apr 2006 4:17 PM
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

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Author
19 Apr 2006 4:28 PM
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/microsoft.public.dotnet.languages.vb/browse_thread/thread/3e2621c4887d94f/01963709a1ee9f8e?lnk=st&q=VB.NET+Wait+Timer+class&rnum=1&hl=en#01963709a1ee9f8e

Please let me know if you need further information.

Thanks for offering help.
Author
19 Apr 2006 4:47 PM
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...

--
Patrice

"Sam" <indianmostwan***@yahoo.com> a écrit dans le message de news:
1145464117.527233.38***@i39g2000cwa.googlegroups.com...
Show quoteHide quote
> 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/microsoft.public.dotnet.languages.vb/browse_thread/thread/3e2621c4887d94f/01963709a1ee9f8e?lnk=st&q=VB.NET+Wait+Timer+class&rnum=1&hl=en#01963709a1ee9f8e
>
> Please let me know if you need further information.
>
> Thanks for offering help.
>
Author
21 Apr 2006 3:23 PM
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.
Author
21 Apr 2006 3:40 PM
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.

--
Patrice

"Sam" <indianmostwan***@yahoo.com> a écrit dans le message de news:
1145632998.487572.295***@t31g2000cwb.googlegroups.com...
Show quoteHide quote
> 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.
>
Author
21 Apr 2006 3:23 PM
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.
Author
21 Apr 2006 3:26 PM
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.
Author
21 Apr 2006 3:26 PM
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.