By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,702 Members | 1,432 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,702 IT Pros & Developers. It's quick & easy.

sleep or delay

P: n/a
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 ?
Feb 13 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"raulavi" <ra*****@discussions.microsoft.com> schrieb
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

Feb 13 '06 #2

P: n/a
> 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).

Feb 13 '06 #3

P: n/a
raulavi wrote:
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
Feb 13 '06 #4

P: n/a
CMM
If this helps to put it into perspective:

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

--
-C. Moya
www.cmoya.com
"Andrew Morton" <ak*@in-press.co.uk.invalid> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
raulavi wrote:
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

Feb 13 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.