Comment #3 on issue 3341 by stephane.ducasse: use #= for integer comparison
instead of #==
http://code.google.com/p/pharo/issues/detail?id=3341
Name: Kernel-dtl.517
Author: dtl
Time: 15 November 2010, 12:49:28.804 pm
UUID: 2c83e064-fa7d-4fc0-8e81-140b88e48a49
Ancestors: Kernel-ul.516
Revert last change to Semaphore>>critical:ifLocked: using latest version
from Cuis, which adds a method comment to explain the reason for use of #==
rather than #=
=============== Diff against Kernel-ul.516 ===============
Item was changed:
----- Method: Semaphore>>critical:ifLocked: (in category 'mutual
exclusion') -----
critical: mutuallyExcludedBlock ifLocked: alternativeBlock
"Evaluate mutuallyExcludedBlock only if the receiver is not
currently in
the process of running the critical: message. If the receiver is,
evaluate
mutuallyExcludedBlock after the other critical: message is finished."
+ "Note: The following is tricky and depends on the fact that the VM
will not switch between processes while executing byte codes (process
switches happen only in real sends). The following test is written
carefully so that it will result in bytecodes only.
+ Do not change the following #== for #=, as #== is not a real
message send, just a bytecode."
+ excessSignals == 0 ifTrue: [
- "Note: The following is tricky and depends on the fact that the VM
will not switch between processes while executing byte codes (process
switches happen only in real sends). The following test is written
carefully so that it will result in bytecodes only."
- excessSignals = 0 ifTrue:[
"If we come here, then the semaphore was locked when the
test executed.
Evaluate the alternative block and answer its result."
^alternativeBlock value
].
^self critical: mutuallyExcludedBlock!