W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2001

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

From: Arnold, Curt <Curt.Arnold@hyprotech.com>
Date: Fri, 20 Apr 2001 13:24:46 -0600
Message-ID: <B2C1451A181BD411B88A00E018C1C19C08ABE2@THOR>
To: "'www-dom-ts@w3.org'" <www-dom-ts@w3.org>
Cc: "'www-dom@w3.org'" <www-dom@w3.org>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:48 GMT