473,395 Members | 1,681 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Replacement code for Threading.Thread.Sleep

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.

Apr 19 '06 #1
8 4201
>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.
Apr 19 '06 #2
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/micro...963709a1ee9f8e

Please let me know if you need further information.

Thanks for offering help.

Apr 19 '06 #3
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" <in**************@yahoo.com> a écrit dans le message de news:
11*********************@i39g2000cwa.googlegroups.c om...
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.

Apr 19 '06 #4
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.

Apr 21 '06 #5
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.

Apr 21 '06 #6
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.

Apr 21 '06 #7
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.

Apr 21 '06 #8
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" <in**************@yahoo.com> a écrit dans le message de news:
11**********************@t31g2000cwb.googlegroups. com...
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.

Apr 21 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Jane Austine | last post by:
As far as I know python's threading module models after Java's. However, I can't find something equivalent to Java's interrupt and isInterrupted methods, along with InterruptedException....
12
by: Jerry Sievers | last post by:
Greetings Pythonists; I have limited experience with threaded apps and plenty with old style forked heavyweight multi-processing apps. Using Python 2.3.3 on a Redhat 7.x machine. Wondering...
4
by: Jurgen Oerlemans | last post by:
Hello I have a program for which I want to see from a distance if it has been started. I made a timer which is enabled when the program is started. Code in the timer: Label_Again: ...
13
by: Mark | last post by:
Hi, Normally in what kind of situation system will abort a thread created manually ? And how do I know the thread is aborted by system after I start it? Thanks! Mark
14
by: John | last post by:
Hi Is there a way to e-mail using outlook2002 from within vb.net without getting the nasty "An application is trying to access you outlook..." message? Thanks Regards
5
by: Peter Proost | last post by:
Hi I got this piece of c# code which runs ok but now I translated it to vb.net (see bottom of post for both pieces) and it keeps erroring out at pi.SetValue(testForm, newValue, x) with this error:...
17
by: OlafMeding | last post by:
Below are 2 files that isolate the problem. Note, both programs hang (stop responding) with hyper-threading turned on (a BIOS setting), but work as expected with hyper-threading turned off. ...
4
by: tdahsu | last post by:
All, I'd appreciate any help. I've got a list of files in a directory, and I'd like to iterate through that list and process each one. Rather than do that serially, I was thinking I should...
6
by: George Sakkis | last post by:
I'm baffled with a situation that involves: 1) an instance of some class that defines __del__, 2) a thread which is created, started and referenced by that instance, and 3) a weakref proxy to the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.