The Trunk: Collections-eem.912.mcz

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

The Trunk: Collections-eem.912.mcz

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

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

Name: Collections-eem.912
Author: eem
Time: 19 September 2020, 1:10:19.845777 pm
UUID: 04ad0d49-19ab-4e40-8570-e63c00cc49ca
Ancestors: Collections-eem.911

Add peekLast to the SharedQueues to complement peek

=============== Diff against Collections-eem.911 ===============

Item was added:
+ ----- Method: SharedQueue>>peekLast (in category 'accessing') -----
+ peekLast
+ "Answer the object that was sent through the receiver last and has not
+ yet been received by anyone. If  no object has been sent, answer nil"
+
+ "SharedQueue new nextPut: 1; nextPut: 2; peekLast"
+
+ ^readSynch
+ critical:
+ [accessProtect critical:
+ [writePosition > 1 ifTrue:
+ [contentsArray at: writePosition - 1]]]
+ ifLocked: [nil]!

Item was added:
+ ----- Method: SharedQueue2>>peekLast (in category 'accessing') -----
+ peekLast
+ "Answer the object that was sent through the receiver last and has not
+ yet been received by anyone. If  no object has been sent, answer nil"
+
+ "SharedQueue2 new nextPut: 1; nextPut: 2; peekLast"
+ ^monitor critical:
+ [items isEmpty ifFalse:
+ [items last]]!