On 4/14/10 4:01 AM, [email protected] wrote:
For example (again, this is not what I am trying to do, but just an example to illustrate) if I want to periodically clean all the cache in the background, withou user interaction, I would say create a thread that calls nsICacheService's method to do that. But how would I get to make that call in the main thread?
There are two possible solutions. The easiest solution here is simply to use nsITimer. It will fire a periodic notification on the main thread.
The more complicated solution that I don't recommend unless it's absolutely necessary is to create a separate thread and periodically send the main thread an event (a nsIRunnable) when you want it to do something. See nsIThreadManager/nsIThread for details. The problem with this approach is that you have to be very careful about thread synchronization if there are any shared structures. --BDS _______________________________________________ dev-embedding mailing list [email protected] https://lists.mozilla.org/listinfo/dev-embedding
