creating a delay

  • Thread starter Thread starter ChrisB
  • Start date Start date
C

ChrisB

Hello:

I was wondering if someone might have a recommendation for creating a delay
within the execution of a .dll.

Currently I am using an empty for/next loop and it takes about 1 billion
cycles seems to create a 1 second delay (I know, probably not a good idea).

I was considering thread.sleep() but don't want to create any unintentional
side effects. Would this be a good idea or are there better options?

Thanks!

Chris
 
What other side effects do you think it might create?

Sleep is the recommended method of delay. Looping forever will choke the
CPU and starve other lower priority threads.

If you are waiting for something, use Synchronization.

-vJ
 
ChrisB said:
Hello:

I was wondering if someone might have a recommendation for creating a
delay within the execution of a .dll.

What's the delay for?
I was considering thread.sleep() but don't want to create any
unintentional side effects. Would this be a good idea or are there
better options?

Unless you're modifying data within the thread, I don't see a problem.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
 
Thread.Sleep() is great for this sort of thing - it's exactly what it is
designed for.

Greg

This posting is provided "AS IS"with no warranties, and confers no rights.
 
Thanks to everyone for the advice.

I am creating the delay for a test component so that information is written
to a database at specified intervals - sounds like thread.sleep() is the way
to go.

I'll give it a try . . .

Chris
 
Back
Top