W3C home > Mailing lists > Public > www-svg@w3.org > March 2004

Re: SVG 1.2 Raw Socket impl. in JavaScript

From: Jan-Klaas Kollhof <keyjaque@yahoo.com>
Date: Wed, 17 Mar 2004 01:35:14 -0800 (PST)
Message-ID: <20040317093514.18058.qmail@web60106.mail.yahoo.com>
To: Peter Sorotokin <psorotok@adobe.com>
Cc: www-svg@w3.org

Hello,
 
> The problem with it is that you really need
> multithreading to do sync reads 
> without locking the UI. ECMAScript lacks it and Java
> has its own socket 
> APIs already.

I am aware of that, but is that realy a problem?
Sure, the Socket has to run in a seperate thread and 
the script needs an object to maybe even wait on or
would have to go into a waiting loop until there is
data available to read if it wishes to do so.
It will involve thread synchronization, is that the
problem?

Doesn't the impl. for async operation use multiple
threads too? At least one that runs in the background
and when data comes in an event is generated and that
event is put into the script's execution queue. The
script object for the event is then run when all other
script objects in the queue before it have finished.
I see this for the timer objects, too.
That's just a guess, though. 
Maybe everything just runs in one single thread.
And any js execution would block everything else.
For the things like event's that will have to run
inside the script I would understand the blocking
because they just could not run whenever some other
script code runs. But I don't think the application
executing the script needs to block, all it needs to
do is to add script objects to a waiting queue and go
on with it's on business.

How do animations work? They run in a seperate thread,
don't they? I can have my animation running and a long
loop in JS at the same time. And if the animation
should fire an event then it is nicely appended to the
executen of the script. Once my loop is done and there
is nothing else to execute the event is dispatched and
the script for the event is run.
 
Maybe I am completely missing something?

I have worked with the Rhino JS engine in Java(the C
impl. Seamonkey is what ASV uses, right?).
My application had multiple threads one of them was
script execution. It ran insided an applet.
Objects inside the script could be accessed from
within the webpage(SVG) through the applet and the
script environment would also fire events which called
objects inside the webpage...
With Rhino it is even possible to create threads in
JavaScript, just try the rhino interactive JS shell.
I did use this in my app, too. 
If Batik would fix the problem with impl. interfaces
in JS then one could even use this in SVG as one can
in Rhino. 

I just don't see multythreading as a problem.

Jan






__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com
Received on Wednesday, 17 March 2004 04:36:13 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 5 November 2012 23:52:55 GMT