Node synchronization [was RE: Node identity comparisons on TS lis t]

Follow up to:
http://lists.w3.org/Archives/Public/www-dom-ts/2001Apr/0030.html
http://lists.w3.org/Archives/Public/www-dom-ts/2001Apr/0032.html

This may probably be something right for the DOM mailing list,
a DOM implementation that consistently returns the same
object for the same underlying node allows you to use that
object to synchronize code that accesses that node.

For example, something like:

for(int i = 0; i < children.getLength(); i++) {
	child = children.item(i);
      synchronized(child) {
		//
		//   do something unsafe

      }
}

Would work as intended if the same node is returned, but would
not block if independent objects were returned for the same node.

Does (or should) DOM 3 address this by adding a getMutex() or 
similar method, something like:

for(int i = 0; i < children.getLength(); i++) {
	child = children.item(i);
      synchronized(child.getMutex()) {
		//
		//   do something unsafe

      }
}

Where an existing implementation that had a one-to-one correspondance 
between nodes and objects could just return "this" for getMutex().


> -----Original Message-----
> From: Joseph Kesselman [mailto:keshlam@us.ibm.com]
> Sent: Friday, April 20, 2001 1:03 PM
> To: Fred L. Drake, Jr.
> Cc: Arnold, Curt; 'www-dom-ts@w3.org'
> Subject: Re: Node identity comparisons
> 
> 
> 
> As far as the DOM API is concerned, Node identity does not 
> guarantee object
> identity. Most existing DOM implementations behave that way, 
> but not all.
> 
> Yes, this was an oversight. Oops.
> 
> DOM Level 3 will address this by adding an isSameNode() operation to
> directly test node identity.
> 
> ______________________________________
> Joe Kesselman  / IBM Research
> 

Received on Friday, 20 April 2001 15:27:04 UTC