sleep or delay

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

what should be used?
In a normal procedure (no thread) I would like to wait (do nothing) for few
secs.

I used a loop with with a clock , sleep and some thing else.

my concern is not to eat the cpu time. what shoul I use?

I see some thread.sleep, but will this work on a normal procedure?
shall I consider a procedure as a thread ? or are there any differences ?
 
raulavi said:
what should be used?
In a normal procedure (no thread) I would like to wait (do nothing)
for few
secs.

I used a loop with with a clock , sleep and some thing else.

my concern is not to eat the cpu time. what shoul I use?

I see some thread.sleep, but will this work on a normal procedure?
shall I consider a procedure as a thread ? or are there any
differences ?

A thread executes code. Your procedure belongs to that code. Use
Thread.Sleep to have the thread sleep.


Armin
 
what should be used?
In a normal procedure (no thread) I would like to wait (do nothing) for few
secs.
my concern is not to eat the cpu time. what shoul I use?

Use System.Threading.Thread.Sleep(Milliseconds).
 
raulavi said:
what should be used?
In a normal procedure (no thread) I would like to wait (do nothing)
for few secs.

I see some thread.sleep, but will this work on a normal procedure?

Yes, and yes.

Andrew
 
If this helps to put it into perspective:

System.Threading.Thread.Sleep(...)
does the same thing AFAIK:
System.Threading.Thread.CurrentThread.Sleep(...)
 

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

Similar Threads

multithreading question 1
Thread.Sleep question 1
Delays "Sleep) 2
Sleep or hibernate 3
How do I stop a SLEEPing thread? 2
Threading Help Required 2
sleep methods in vb.net 4
Alternative to Thread.Sleep? 9

Back
Top