Re: nsIStreamListener call

Neil <[email protected]> Thu, 30 Jan 2014 16:02:41 +0000
Newsgroups gmane.comp.mozilla.devel.xpfe
Message-ID <[email protected]>
[email protected] wrote:

>When the data is available then OnDataAvailable() callback will be called and we will read the data from the channel and main thread continue to process as per the data available.
>
Callbacks don't work like that.

All Gecko threads run an event loop. In the case of the UI thread this 
thread processes native UI events. Other threads only process Gecko 
events, known as runnables.

Once you call AsyncOpen you need to return to your calling event loop. 
At some point a runnable will be posted to the loop which will trigger 
the OnDataAvailable call.

-- 
Warning: May contain traces of nuts.