On May 16, 2006, at 10:31 AM, Andrew Keller wrote:

If you have a process that is supposed to execute at a regular interval, is it more efficent to use a timer, or to put the code in a thread and use the sleep command?

A Timer will only execute when the time period has expired *and* when there are no other processes. A Timer is very efficient since it only works when your App is not doing anything anyways, but it's period interval is not guaranteed.

A thread will wake from sleep when the time period has expired and the next thread manager loop determines which thread has the next priority. So if you need this process to fire consistently at a precise time interval, then use the thread sleep method with a high priority value (to give precedence over other threads).

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to