f



parallel processing

HI,
I have a tricky problem about parallel processing using JavaScript.

a script makes use of classes.
2 objects A and B are created at intialisation. The two objects make
use of the same function foo().
at runtime, the action:
A.foo();
B.foo();
is executed. 

I noticed that in any browser, the result will be that the browser
executes the function foo() related to A. Then stop and execute the
function foo() related to B. This leave A unfinished.
Is there a possiblity to have the function called by A running at the
same time than B's one? I mean having two instance of the function
running at once.

Any help would be greatly apreciated.

Thank you.

Alexandre MELARD.
0
amelard
6/6/2004 12:19:31 PM
comp.lang.javascript 38370 articles. 2 followers. javascript4 (1315) is leader. Post Follow

6 Replies
788 Views

Similar Articles

[PageSpeed] 56

On 6 Jun 2004 05:19:31 -0700, amelard@hotmail.com (Alexandre MELARD)
wrote:

>I have a tricky problem about parallel processing using JavaScript.

I've never seen a JS implementation that isn't single threaded.

Jim.
-- 
comp.lang.javascript FAQ - http://jibbering.com/faq/

0
jim
6/6/2004 8:47:05 PM
In article <ebce2377.0406060419.7ccabcad@posting.google.com>, Alexandre
MELARD <amelard@hotmail.com> wrote:

> HI,
> I have a tricky problem about parallel processing using JavaScript.
> 
> a script makes use of classes.
> 2 objects A and B are created at intialisation. The two objects make
> use of the same function foo().
> at runtime, the action:
> A.foo();
> B.foo();
> is executed. 
> 
> I noticed that in any browser, the result will be that the browser
> executes the function foo() related to A. Then stop and execute the
> function foo() related to B. This leave A unfinished.
> Is there a possiblity to have the function called by A running at the
> same time than B's one? I mean having two instance of the function
> running at once.
> 
> Any help would be greatly apreciated.
> 
> Thank you.
> 
> Alexandre MELARD.

Please be clearer as to what you mean by unfinished. There is no
parallel procesing in javascript. The function will be reused with its
variables reinitialized.

-- 
Dennis Marks
http://www.dcs-chico.com/~denmarks/
Mail to the return email address is bounced.
Go to web site for active email address.


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 100,000 Newsgroups - 19 Different Servers! =-----
0
Dennis
6/6/2004 10:55:56 PM
jim@jibbering.com (Jim Ley) wrote in message news:<40c382b2.35732260@news.individual.net>...
> On 6 Jun 2004 05:19:31 -0700, amelard@hotmail.com (Alexandre MELARD)
> wrote:
> 
> >I have a tricky problem about parallel processing using JavaScript.
> 
> I've never seen a JS implementation that isn't single threaded.
> 
> Jim.

Ok, I run a script which make sliding panels. 
When onmuseover, a panel start sliding calling a function slide().
I call the same function for every panels. The problem is that when
moving a panel, if the user point th emouse over another panel. The
first one stop and the last panel start moving. Thus leaving the first
where it was...

So if it is really multi-threading, why the I cannot run two instance
of a function at one time?

Alexandre.
0
amelard
6/7/2004 8:40:46 AM
On 7 Jun 2004 01:40:46 -0700, Alexandre MELARD wrote:
> jim@jibbering.com (Jim Ley) wrote in message news:...
>> On 6 Jun 2004 05:19:31 -0700, (Alexandre MELARD) wrote:
>> 
>>>I have a tricky problem about parallel processing using JavaScript.
>> 
>> I've never seen a JS implementation that isn't single threaded.
....
> So if it is really multi-threading, why the I cannot run two instance
> of a function at one time?

...err.  Hold up.  I think that sentence of Jim's
had a few too many 'double negatives' to be easy
to understand.  I might rewrite Jim's words as..

<apologies if wrong>
"I have *always* seen single thread JS"
</apologies if wrong>

-- 
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
0
Andrew
6/7/2004 9:13:28 AM
amelard@hotmail.com (Alexandre MELARD) wrote in message news:<ebce2377.0406060419.7ccabcad@posting.google.com>...
> HI,
> I have a tricky problem about parallel processing using JavaScript.
> 
> a script makes use of classes.
> 2 objects A and B are created at intialisation. The two objects make
> use of the same function foo().
> at runtime, the action:
> A.foo();
> B.foo();
> is executed. 
> 
> I noticed that in any browser, the result will be that the browser
> executes the function foo() related to A. Then stop and execute the
> function foo() related to B. This leave A unfinished.
> Is there a possiblity to have the function called by A running at the
> same time than B's one? I mean having two instance of the function
> running at once.
> 
> Any help would be greatly apreciated.
> 
> Thank you.
> 
> Alexandre MELARD.


   I guess that the judicial use of setInterval() method  can make the
script appear to be multi-threaded. I've used this to create a clock
in one frame, while there is extended processing in another frame
going on. This way the user at least sees that his machine is not
frozen
0
bruce_brodinsky
6/7/2004 6:38:18 PM
Hi, 
There is only ONE double negative in Jim's post. 
And Jim's makes more sense than Andrew's useless answer.

Hi Alex,
You cannot make the same function run two things separately.

http://www.caoxuan.com/cxk/webart/goodies/zind.html

I suggest that you make allowance for the user to do whatever he
chooses.
So as he touches the second panel, put the first panel into it's final
position before moving the second panel.

http://www.caoxuan.com/cxk/webart/goodies/slidemenu.html

HTH
Kien




Andrew Thompson <SeeMySites@www.invalid> wrote in message
news:<va92y96rbzq0.1iti1iwfh82lx$.dlg@40tude.net>...
> On 7 Jun 2004 01:40:46 -0700, Alexandre MELARD wrote:
> > jim@jibbering.com (Jim Ley) wrote in message news:...

> >> On 6 Jun 2004 05:19:31 -0700, (Alexandre MELARD) wrote:
> >> 
> >>>I have a tricky problem about parallel processing using JavaScript.
> >> 
> >> I've never seen a JS implementation that isn't single threaded.
>  ...
> > So if it is really multi-threading, why the I cannot run two instance
> > of a function at one time?
> 
> ..err.  Hold up.  I think that sentence of Jim's
> had a few too many 'double negatives' to be easy
> to understand.  I might rewrite Jim's words as..
> 
> <apologies if wrong>
> "I have *always* seen single thread JS"
> </apologies if wrong>
0
caoxuankien
6/8/2004 2:04:21 AM
Reply: