-
Notifications
You must be signed in to change notification settings - Fork 65
/
ShootoutPair.class.st
68 lines (57 loc) · 1.19 KB
/
ShootoutPair.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Class {
#name : #ShootoutPair,
#superclass : #Object,
#instVars : [
'partner',
'me',
'sema'
],
#category : #'CogBenchmarks-Shootout'
}
{ #category : #'instance creation' }
ShootoutPair class >> new [
"Answer a newly created and initialized instance."
^super new initialize.
]
{ #category : #'instance creation' }
ShootoutPair class >> with: me [
"Answer a newly created and initialized instance."
self halt.
^super new initialize me: me
]
{ #category : #'initialize-release' }
ShootoutPair >> initialize [
"Initialize a newly created instance. This method must answer the receiver."
partner := nil.
me := nil.
sema := Semaphore new.
^self
]
{ #category : #accessing }
ShootoutPair >> me [
^me
]
{ #category : #accessing }
ShootoutPair >> me: anObject [
me := anObject
]
{ #category : #accessing }
ShootoutPair >> partner [
^partner
]
{ #category : #accessing }
ShootoutPair >> partner: anObject [
partner := anObject
]
{ #category : #'initialize-release' }
ShootoutPair >> release [
partner:=nil.
]
{ #category : #'initialize-release' }
ShootoutPair >> signal [
sema signal
]
{ #category : #'initialize-release' }
ShootoutPair >> wait [
sema wait
]