On 07/19/2012 01:16 PM, Boris Zbarsky wrote:
On 7/19/12 4:04 PM, Jason Duell wrote:
nsITimer.idl says nothing about thread safety. (Can we add some?)

 From a glance at the code, it appears that it's safe to Cancel and
null-out an nsITimer from any given thread, so long as the timer
callback that's pointed to has thread-safe refcounting. Correct?

If I recall correctly, it's "unsafe" to fire an nsITimer on any thread other than the main thread. At least insofar as it will cause races on the timers' delay adjustment mechanism.... It won't crash, but can cause timer firing times to get all weird.

(Note that it's not _intended_ that this be unsafe; it's just implemented in an unsafe way.)

Right--but whether can we *cancel* timers from any thread is my specific question here. Looks like you can if your callback is thread-safe IIUTCC

Jason

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to