The Simple Background Thread demo creates an instance of
nsISimpleBackgroundThread and runs it with a single thread. There is no way
for this thread to directly communicate with the UI thread so the only way to
watch its progress is through the log messages it sends to the JavaScript
console.First open the JavaScript console then click the "run" button to start
a thread. Every time you click the "run" button you create a new component
instance with its own thread executing it.The Proxy Callback demo uses a proxied callback object to send
notifications from a worker thread to the UI thread. A Proxy Object allows a
thread to call a method to be executed on a different thread by passing the
call through the target thread's event queue. In this demo, a callback is
created and wrapped in a proxy object using the UI's event queue. This allows
the created thread to call methods on the proxied callback that are executed
on the UI thread. This provides a way for the worker thread to send update
notifications to the UI.Click the "run" button to start a thread with a callback that will
send status updates to the listbox below.The Asynch Service demo shows how you can create your own event queue
and use a proxy to produce a component where all method calls are queued up and
handled one by one.Click the "start" button to create and start an instance of the
service. The service will wait in its event loop until a method call is placed
via its proxy object. These calls are dispatched asynchronously preventing the
UI thread from blocking. Click the "method one" and "method two" buttons to
call methods on the proxy and see how they are executed in order. Click "stop"
to terminate the service's event queue.