The Trunk: Kernel-eem.1184.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Kernel-eem.1184.mcz

commits-2
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.1184.mcz

==================== Summary ====================

Name: Kernel-eem.1184
Author: eem
Time: 26 July 2018, 9:02:17.653687 pm
UUID: 37221c94-8415-41a5-8535-b047f59150b9
Ancestors: Kernel-eem.1183

Now that Kernel-eem.1183 has fixed the process termination in critical: in the face of higher priority processes issue, we can go back to a simpler implementation of Semaphore>>critical:, albeit one marked with ther <criticalSection> pragma for visibility in Process>>#terminate.

=============== Diff against Kernel-eem.1183 ===============

Item was changed:
  ----- Method: Semaphore>>critical: (in category 'mutual exclusion') -----
  critical: mutuallyExcludedBlock
  "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."
  <criticalSection>
+ self wait.
+ ^mutuallyExcludedBlock ensure: [self signal]
- | caught |
- "We need to catch eventual interruptions very carefully.
- The naive approach of just doing, e.g.,:
- self wait.
- aBlock ensure:[self signal].
- will fail if the active process gets terminated while in the wait.
- However, the equally naive:
- [self wait.
- aBlock value] ensure:[self signal].
- will fail too, since the active process may get interrupted while
- entering the ensured block and leave the semaphore signaled twice.
- To avoid both problems we make use of the fact that interrupts only
- occur on sends (or backward jumps) and use an assignment (bytecode)
- right before we go into the wait primitive (which cannot be preempted)."
-
- caught := false.
- ^[
- caught := true.
- self wait.
- mutuallyExcludedBlock value
- ] ensure: [ caught ifTrue: [self signal] ]
  !