<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>The ifAbsentBlock is being evaluated in the
critical section of this method. As a result, this block cannot modify the
btreeDictionary. If we move the ifAbsentBlock evaluation to outside
of the critical section would this method still be "correct"? Here is how
it would read:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>valueAt: aKey ifAbsent:
aBlock<BR> "Private - Answer correct
version of value holder at aKey, <BR>
evaluate aBlock if absent."</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> | value |<BR>
changed == nil ifFalse: [<BR> value :=
changed at: aKey.<BR> value == nil
ifFalse: [ ^value ]<BR> ].<BR>
dataBaseObject == nil ifTrue: [ ^aBlock value ].<BR> "critical
section begin"<BR> mutex critical:
[<BR> (value := dataBaseObject
iterator goTo: aKey; getCurrent)
].<BR> "critical section end"</FONT></DIV>
<DIV><FONT face=Arial size=2> "evaluate aBlock outside the
critical section"</FONT></DIV>
<DIV><FONT face=Arial size=2> value ==
nil<BR>
ifTrue: [^aBlock value].<BR> value := ODBValueHolder createOn:
value value.<BR> [transaction versionDescriptor versionOK:
value versionNumber]<BR> whileFalse:
[value loadPreviousVersionFrom: transaction oldHolders].<BR>
^value</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks.</FONT></DIV>
<DIV><FONT face=Arial size=2>Derek Brans<BR>Nerd on a Wire<BR>Web design that's
anything but square<BR><A
href="http://www.nerdonawire.com">http://www.nerdonawire.com</A> <BR>mailto: <A
href="mailto:brans@nerdonawire.com">brans@nerdonawire.com</A><BR>phone:
604.874.6463<BR>toll-free: 1-877-NERD-ON-A-WIRE</FONT></DIV></BODY></HTML>