joe ertaba wrote:
Hi

I need to add sleep function in some procedure, I found some sleep function

Let me start by asking you something: "Why do you need this?"

Is it perhaps because some function (feature) in your code needs to wait for other functions (features) to complete/finish?

If yes, then please don't use setTimeout() nor nsITimer but use the nsIObserverService to notify your code, or fire some event when it is done.

Fixed timers/delays are never a good option, because your computer might be either slower or faster than mine, making one of us wait just because the other has a slower CPU/hardware.

Also, some people use recursive calls (too much) but they can be quiet harmful when things get broken, and stall the UI.

Cheers,
/HJ

--
I am HJ and I LIVE STRONG.
Supporter of the Lance Armstrong Foundation
http://www.livestrong.org
_______________________________________________
Project_owners mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/project_owners

Reply via email to