Sign In/My Account | View Cart  
advertisement

Article:
 Very Dynamic Web Interfaces
Subject: A threadsafe implementation for XMLHTTPRequest
Date: 2007-10-02 00:31:58
From: fiskus
Response to: A threadsafe implementation for XMLHTTPRequest

Interesting.


I came up with a very similar solution to this problem. (See http://badcoding.blogspot.com/2007/06/fun-with-ajax.html)


(Yes, it was a month after you, but quite independently ;-)


You appear to have assigned both the handler and the callback to local variables prior to issuing the call. However, I'm not sure whether passing the handler by reference like this is really thread safe in an interpretive language like javascript. (I may be wrong, but it was the impression I got when testing)


I tried to avoid this problem by storing the handlers in a global array, and passing the array index to the callback function. This is definitely thread safe, although having a global array that grows like a stack of discarded dishes isn't a great idea, either!


Previous Message Previous Message Move up to Parent Message Up Next Message No Next Message


Sponsored By: