[Project_owners] some questions about xpcom

Neil Deakin enndeakin at sympatico.ca
Mon Feb 23 09:41:23 EST 2004


Davide Carboni wrote:

> Neil Deakin wrote:
>
>> dcarboni at crs4.it wrote:
>>
>>> ----- Original Message -----
>>> From: Neil <neil at parkwaycc.co.uk>
>>> Date: Saturday, February 21, 2004 2:05 am
>>> Subject: Re: [Project_owners] some questions about xpcom
>>>
>>>  
>>>
>>>> Davide Carboni wrote:
>>>>
>>>>  
>>>>
>>>>> I hope not that the answer is "stop using Javascript and use C++ 
>>>>> instead", because it is hard to accept such a change ;)
>>>>>     
>>>>
>>>>
>>>> At least, it's not implemented as such in Mozilla... all JavaScript 
>>>> is proxied on to the UI thread.
>>>>   
>>>
>>>
>>>
>>>
>>>
>>> (writing from the Mozilla developer room at Fosdem in Brussels)
>>>
>>> It seems a big limitation in application development. The strenght of
>>> RAD in Mozilla is in the combination of XML/scritping languages upon a
>>> stable XPCom platform. Don't you think guys that something should be
>>> done to allow scripts to be multi-threaded? Otherwise, Mozilla will 
>>> stay
>>> a step behind to other development platforms IMHO.
>>> D.
>>>  
>>>
>> Could you explain why you need another thread, and why using 
>> setTimeout isn't a possibility for your purposes?
>>
>> I don't think there's any issue with actually using threads in 
>> JavaScript, at least not issues that couldn't be fixed. Making every 
>> XPCOM component in Mozilla threadsafe however would take far more 
>> time that anyone has.
>
>
>
> My chrome apps have a list of IP numbers (hundreds of numbers) and try 
> to connect to each of them and make a Gnutella  handshaking until  
> three or four connection are successfully established. Consider that 
> most of the IP are probably off-line and the majority of the others 
> simply refuse the connection.
>
Sockets and other network connections can be opened asynchronously and 
use listeners to detect when the data arrives and when the connection 
ends so all the threading is done for you. See  
http://www.xulplanet.com/tutorials/mozsdk/sockets.php  for example.

You could even still use timeouts since you are just iterating over a 
list of numbers.

/ Neil



More information about the Project_owners mailing list