Re: [jQuery] filter refactored with the engine of Chili

2006-11-28 Thread Andrea Ercolino

http://jquery.com/dev/bugs/bug/447/

-- 
View this message in context: 
http://www.nabble.com/filter-refactored-with-the-engine-of-Chili-tf2718426.html#a7583601
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] filter refactored with the engine of Chili

2006-11-28 Thread Christof Donat
Hi

   if( jQuery.parse2RE == 0 ) { 
   // this is the first call to filter_opt, so
   // replace S and T macros in the parse2 regexps
   var S = ([a-z*_-][\\w-]*);

You can not be shure that a JavaScript Engine is not threaded. This code is 
not threadsave. Imagine the following situation:

Thread 1Thread 2
$.filter()
parse2RE is set to e.g. 1
Thread is stopped by OS Sceduler - $.filter()
jQuery.parse2RE != 0 !!

That kind of problems is very problematic, because they are timing-dependant 
and may or may not occur on each run. Maybe you can find a way to use an 
additional Parameter for that.

Christof

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] filter refactored with the engine of Chili

2006-11-28 Thread Mike Alsup
 You can not be shure that a JavaScript Engine is not threaded. This code is
 not threadsave.

Is there an implementation of javascript that supports context switching?

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] filter refactored with the engine of Chili

2006-11-28 Thread Andrea Ercolino


Christof Donat wrote:
 
 You can not be shure that a JavaScript Engine is not threaded. This code
 is 
 not threadsave. Imagine the following situation:
 
 Thread 1Thread 2
 $.filter()
 parse2RE is set to e.g. 1
 Thread is stopped by OS Sceduler - $.filter()
 jQuery.parse2RE != 0 !!
 

Yes, but if it's not 0 it's ok I guess. There is a preprocessing step that
sets parse2RE, and if it's not 0 isn't it safe to suppose it holds the
correct RegExp object set during preprocessing?

-- 
View this message in context: 
http://www.nabble.com/filter-refactored-with-the-engine-of-Chili-tf2718426.html#a7584966
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] filter refactored with the engine of Chili

2006-11-28 Thread Christof Donat
Hi,

 Yes, but if it's not 0 it's ok I guess.

I have not analyzed your code deeply. It was just something I sumbled across. 

 There is a preprocessing step that 
 sets parse2RE, and if it's not 0 isn't it safe to suppose it holds the
 correct RegExp object set during preprocessing?

Ah, I understand. That was the point I was missing when I read your code :-)

Christof

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] filter refactored with the engine of Chili

2006-11-28 Thread Christof Donat
Hi,

  You can not be shure that a JavaScript Engine is not threaded. This code
  is not threadsave.

 Is there an implementation of javascript that supports context switching?

The engine itsself usually does no contextswitch, but it may start multiple 
threads to handle multiple Events simultanuously. These threads then can be 
stoped by the OS and another thread of the JS-engine can run.

I am not shure if the Firefox JS-Engine is single-threaded. I am pretty shure 
that the engines in IE and Konqueror are, but I have no clue about Opera. 
Anyway there is no promise that this will never change.

Christof

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/