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(...)
 
Back
Top