Hi Friends..,

I have some problem in my timer thread.....

the actual problem is... if i start only my application means timer is working fine.....but if i start any other application in my desktop means...problem arising in timer....timer becomes slow in action...

and i have used Sleep range of 1000 in thread

thread.sleep(1000);

but whn i compare with my system time it becomes slow..in result

If your application gets less CPU cycles it might become more sluggish.
The sleep time is defined as the minimum time the thread will sleep, not an exact time.

If another application eats most of your CPU, the one you're monitoring may not get enough of a timeslice to hit that sleeping thread just after a second, causing it to lag behind.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.