author | hlopkmar |
Tue, 29 Nov 2011 15:05:23 +0000 | |
branch | jk_new_structure |
changeset 1181 | 36396857af53 |
parent 1179 | 26fa6829e4d7 |
child 1194 | 9f910257b6e8 |
permissions | -rw-r--r-- |
1142 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
1152 | 3 |
|
1155 | 4 |
New code and modifications done at SWING Research Group [1]: |
1152 | 5 |
|
1142 | 6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
7 |
SWING Research Group, Czech Technical University in Prague |
|
8 |
||
9 |
This software is furnished under a license and may be used |
|
10 |
only in accordance with the terms of that license and with the |
|
11 |
inclusion of the above copyright notice. This software may not |
|
12 |
be provided or otherwise made available to, or used by, any |
|
13 |
other person. No title to or ownership of the software is |
|
14 |
hereby transferred. |
|
15 |
||
1155 | 16 |
[1] Code written at SWING Research Group contains a signature |
17 |
of one of the above copright owners. For exact set of such code, |
|
18 |
see the differences between this version and version stx:libjava |
|
1152 | 19 |
as of 1.9.2010 |
1142 | 20 |
" |
21 |
"{ Package: 'stx:libjava' }" |
|
22 |
||
23 |
Object subclass:#JavaMonitor |
|
1172 | 24 |
instanceVariableNames:'owningProcess processesEntered monitorSema count waitingSema |
25 |
processesWaiting' |
|
26 |
classVariableNames:'instVarAccess' |
|
1142 | 27 |
poolDictionaries:'' |
28 |
category:'Languages-Java-Support' |
|
29 |
! |
|
30 |
||
31 |
!JavaMonitor class methodsFor:'documentation'! |
|
32 |
||
33 |
copyright |
|
34 |
" |
|
35 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
1152 | 36 |
|
1155 | 37 |
New code and modifications done at SWING Research Group [1]: |
1152 | 38 |
|
1142 | 39 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
40 |
SWING Research Group, Czech Technical University in Prague |
|
41 |
||
42 |
This software is furnished under a license and may be used |
|
43 |
only in accordance with the terms of that license and with the |
|
44 |
inclusion of the above copyright notice. This software may not |
|
45 |
be provided or otherwise made available to, or used by, any |
|
46 |
other person. No title to or ownership of the software is |
|
47 |
hereby transferred. |
|
48 |
||
1155 | 49 |
[1] Code written at SWING Research Group contains a signature |
50 |
of one of the above copright owners. For exact set of such code, |
|
51 |
see the differences between this version and version stx:libjava |
|
1152 | 52 |
as of 1.9.2010 |
1142 | 53 |
|
54 |
" |
|
55 |
! ! |
|
56 |
||
1172 | 57 |
!JavaMonitor class methodsFor:'initialization'! |
58 |
||
59 |
initialize |
|
60 |
instVarAccess := RecursionLock forMutualExclusion. |
|
61 |
||
62 |
"Created: / 29-11-2011 / 11:23:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
63 |
! ! |
|
64 |
||
1142 | 65 |
!JavaMonitor class methodsFor:'instance creation'! |
66 |
||
67 |
new |
|
68 |
^self basicNew initialize. |
|
69 |
||
70 |
"Created: / 20-11-2011 / 14:30:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
71 |
! ! |
|
72 |
||
73 |
!JavaMonitor methodsFor:'accessing'! |
|
74 |
||
1143
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
75 |
activeProcess |
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
76 |
^ Processor activeProcess |
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
77 |
! |
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
78 |
|
1142 | 79 |
copyProcessesEntered |
80 |
^ processesEntered copy. |
|
81 |
||
82 |
"Created: / 20-11-2011 / 14:45:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
83 |
! |
|
84 |
||
85 |
processesEntered |
|
1143
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
86 |
"dont do anything to me, access needs to be sync'd" |
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
87 |
^ processesEntered. |
1142 | 88 |
|
89 |
"Created: / 20-11-2011 / 13:22:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
90 |
! ! |
|
91 |
||
1143
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
92 |
!JavaMonitor methodsFor:'atomic'! |
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
93 |
|
1172 | 94 |
addProcess: aProcess |
95 |
instVarAccess critical: [ processesEntered add: aProcess ]. |
|
1143
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
96 |
|
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
97 |
"Created: / 20-11-2011 / 20:30:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
98 |
! |
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
99 |
|
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
100 |
clearOwningProcess |
1172 | 101 |
instVarAccess critical: [ owningProcess := nil ]. |
1143
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
102 |
|
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
103 |
"Created: / 20-11-2011 / 20:34:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
104 |
! |
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
105 |
|
1145
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
106 |
decrement |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
107 |
"owning process released monitor, lets lower our counter so we know how many times |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
108 |
do we have to release it" |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
109 |
|
1172 | 110 |
instVarAccess critical: [ count := count - 1 ]. |
1145
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
111 |
|
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
112 |
"Created: / 22-11-2011 / 10:49:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
113 |
! |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
114 |
|
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
115 |
increment |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
116 |
"owning process entered monitor again (recursion ...), lets raise our counter so we know how many times |
1172 | 117 |
do we have to release it" |
118 |
||
119 |
instVarAccess critical: [ count := count + 1 ]. |
|
1145
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
120 |
|
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
121 |
"Created: / 22-11-2011 / 10:49:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
122 |
! |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
123 |
|
1172 | 124 |
owningProcess: aProcess |
125 |
instVarAccess critical: [ owningProcess := aProcess ]. |
|
1143
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
126 |
|
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
127 |
"Created: / 20-11-2011 / 20:32:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
128 |
! |
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
129 |
|
1146 | 130 |
processesWaitingAdd: aProcess |
1172 | 131 |
instVarAccess |
132 |
critical: [ |
|
133 |
self assert: (processesWaiting includesKey: aProcess) not. |
|
134 |
processesWaiting at: aProcess put: count |
|
135 |
]. |
|
1146 | 136 |
|
137 |
"Created: / 22-11-2011 / 11:57:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
138 |
! |
|
139 |
||
140 |
processesWaitingRestore: aProcess |
|
1172 | 141 |
instVarAccess |
142 |
critical: [ |
|
143 |
self assert: (processesWaiting includesKey: aProcess). |
|
144 |
self reinitCounter: (processesWaiting at: aProcess). |
|
145 |
processesWaiting removeKey: aProcess |
|
146 |
]. |
|
1146 | 147 |
|
148 |
"Created: / 22-11-2011 / 12:59:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
149 |
! |
|
150 |
||
1145
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
151 |
reinitCounter |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
152 |
"owning process is different from previous, lets start counting from beginning" |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
153 |
|
1172 | 154 |
instVarAccess critical: [ count := 1 ]. |
1145
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
155 |
|
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
156 |
"Created: / 22-11-2011 / 10:51:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
157 |
! |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
158 |
|
1146 | 159 |
reinitCounter: newCount |
1172 | 160 |
instVarAccess critical: [ count := newCount ]. |
1146 | 161 |
|
162 |
"Created: / 22-11-2011 / 13:00:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
163 |
! |
|
164 |
||
1145
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
165 |
removeProcess: aProcess |
1172 | 166 |
instVarAccess |
1146 | 167 |
critical: [ |
168 |
self assert: processesEntered last == aProcess. |
|
169 |
processesEntered remove: aProcess |
|
170 |
]. |
|
1143
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
171 |
|
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
172 |
"Created: / 20-11-2011 / 20:28:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
173 |
! ! |
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
174 |
|
1142 | 175 |
!JavaMonitor methodsFor:'initialization'! |
176 |
||
177 |
initialize |
|
178 |
owningProcess := nil. |
|
1172 | 179 |
|
1143
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
180 |
processesEntered := OrderedCollection new. |
1172 | 181 |
|
1142 | 182 |
monitorSema := Semaphore new: 1. |
1172 | 183 |
|
1146 | 184 |
processesWaiting := Dictionary new. |
1172 | 185 |
|
1146 | 186 |
waitingSema := Semaphore new: 0. |
1142 | 187 |
|
188 |
"Created: / 20-11-2011 / 13:28:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
189 |
! ! |
|
190 |
||
191 |
!JavaMonitor methodsFor:'public'! |
|
192 |
||
193 |
acquire |
|
194 |
| thisProcess | |
|
1143
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
195 |
thisProcess := self activeProcess. |
1145
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
196 |
(self isOwnedBy: thisProcess) ifTrue: [ |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
197 |
self increment. |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
198 |
^ self |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
199 |
]. |
1142 | 200 |
monitorSema wait. |
1143
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
201 |
self owningProcess: thisProcess. |
1145
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
202 |
self reinitCounter. |
1142 | 203 |
|
204 |
"Created: / 20-11-2011 / 13:21:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
205 |
! |
|
206 |
||
207 |
enter |
|
208 |
| thisProcess | |
|
1143
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
209 |
thisProcess := self activeProcess. |
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
210 |
self addProcess: thisProcess. |
1142 | 211 |
self acquire. |
212 |
||
213 |
"Created: / 20-11-2011 / 13:21:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
214 |
! |
|
215 |
||
216 |
exit |
|
1143
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
217 |
| thisProcess | |
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
218 |
thisProcess := self activeProcess. |
1169 | 219 |
(self isOwnedBy: thisProcess) ifTrue: [ self release. ]. |
220 |
processesEntered remove: thisProcess ifAbsent: nil. |
|
1142 | 221 |
|
222 |
"Created: / 20-11-2011 / 13:21:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
223 |
! |
|
224 |
||
1146 | 225 |
notify |
226 |
"wakeup one waiting process" |
|
227 |
||
228 |
| thisProcess | |
|
229 |
thisProcess := Processor activeProcess. |
|
1179 | 230 |
self assert: (self isOwnedBy: thisProcess). |
231 |
Logger |
|
232 |
log: ('%1: notifying %2 processes' bindWith: thisProcess printString with:processesWaiting size) |
|
233 |
severity: #debug |
|
234 |
facility: #JVM. |
|
1146 | 235 |
waitingSema signal. |
236 |
||
237 |
"Created: / 22-11-2011 / 12:14:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
238 |
! |
|
239 |
||
240 |
notifyAll |
|
241 |
"wakeup one waiting process" |
|
242 |
||
243 |
| thisProcess | |
|
244 |
thisProcess := Processor activeProcess. |
|
245 |
self assert: (self isOwnedBy: thisProcess). |
|
1181
36396857af53
more logging for monitors, do you have the feeling that I'm desperate? :)
hlopkmar
parents:
1179
diff
changeset
|
246 |
Logger |
36396857af53
more logging for monitors, do you have the feeling that I'm desperate? :)
hlopkmar
parents:
1179
diff
changeset
|
247 |
log: ('%1: notifying all %2 processes' bindWith: thisProcess printString |
36396857af53
more logging for monitors, do you have the feeling that I'm desperate? :)
hlopkmar
parents:
1179
diff
changeset
|
248 |
with: processesWaiting size) |
36396857af53
more logging for monitors, do you have the feeling that I'm desperate? :)
hlopkmar
parents:
1179
diff
changeset
|
249 |
severity: #debug |
36396857af53
more logging for monitors, do you have the feeling that I'm desperate? :)
hlopkmar
parents:
1179
diff
changeset
|
250 |
facility: #JVM. |
1146 | 251 |
waitingSema signalForAll. |
252 |
||
253 |
"Created: / 22-11-2011 / 12:14:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
254 |
! |
|
255 |
||
1142 | 256 |
release |
257 |
| thisProcess | |
|
1143
5e1de8c6b43e
JavaMonitor more or less finished.. integration coming soon
hlopkmar
parents:
1142
diff
changeset
|
258 |
thisProcess := self activeProcess. |
1145
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
259 |
self assert: (self isOwnedBy: owningProcess). |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
260 |
count == 1 ifTrue: [ |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
261 |
self clearOwningProcess. |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
262 |
monitorSema signal. |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
263 |
] ifFalse: [ |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
264 |
self decrement. |
8728f5373a48
end of the old monitors has come, new monitors plugged in, not yet bugfree I'm sure
hlopkmar
parents:
1144
diff
changeset
|
265 |
] |
1142 | 266 |
|
267 |
"Created: / 20-11-2011 / 13:21:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1146 | 268 |
! |
269 |
||
270 |
releaseAll |
|
271 |
count timesRepeat: [self release]. |
|
272 |
||
273 |
"Created: / 22-11-2011 / 13:05:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
274 |
! |
|
275 |
||
276 |
wait |
|
277 |
"make owning process to go to wait" |
|
278 |
||
279 |
self waitForMilliseconds: nil. |
|
280 |
||
281 |
"Created: / 22-11-2011 / 11:57:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
282 |
! |
|
283 |
||
284 |
waitForMilliseconds: timeOut |
|
285 |
"make owning process to go to wait, but not longer than timeout" |
|
286 |
||
287 |
| thisProcess | |
|
288 |
thisProcess := Processor activeProcess. |
|
289 |
self assert: (self isOwnedBy: thisProcess). |
|
1179 | 290 |
Logger |
1181
36396857af53
more logging for monitors, do you have the feeling that I'm desperate? :)
hlopkmar
parents:
1179
diff
changeset
|
291 |
log: ('%1 is going to wait for timeout: %2' bindWith: thisProcess printString with: timeOut) |
36396857af53
more logging for monitors, do you have the feeling that I'm desperate? :)
hlopkmar
parents:
1179
diff
changeset
|
292 |
severity: #debug |
36396857af53
more logging for monitors, do you have the feeling that I'm desperate? :)
hlopkmar
parents:
1179
diff
changeset
|
293 |
facility: #JVM. |
1146 | 294 |
self processesWaitingAdd: thisProcess. |
295 |
self releaseAll. |
|
1169 | 296 |
"JV@2011-11-25: zero timeout means wait without timeout!!!!!!" |
297 |
timeOut == 0 ifTrue: [ waitingSema wait ] ifFalse: [ |
|
1159 | 298 |
waitingSema waitWithTimeoutMs: timeOut |
299 |
]. |
|
1179 | 300 |
Logger |
301 |
log: ('%1 has been notified and continues' |
|
302 |
bindWith: thisProcess printString) |
|
303 |
severity: #debug |
|
304 |
facility: #JVM. |
|
1146 | 305 |
self acquire. |
306 |
self processesWaitingRestore: thisProcess. |
|
307 |
||
308 |
"Created: / 22-11-2011 / 12:52:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1159 | 309 |
"Modified (comment): / 25-11-2011 / 18:30:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1181
36396857af53
more logging for monitors, do you have the feeling that I'm desperate? :)
hlopkmar
parents:
1179
diff
changeset
|
310 |
"Modified: / 29-11-2011 / 16:02:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1142 | 311 |
! ! |
312 |
||
313 |
!JavaMonitor methodsFor:'queries'! |
|
314 |
||
315 |
isAcquired |
|
1172 | 316 |
^ instVarAccess critical: [ owningProcess notNil ]. |
1142 | 317 |
|
318 |
"Created: / 20-11-2011 / 13:22:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
319 |
! |
|
320 |
||
321 |
isOwnedBy: aProcess |
|
1172 | 322 |
^ instVarAccess critical: [ owningProcess == aProcess ]. |
1142 | 323 |
|
324 |
"Created: / 20-11-2011 / 13:23:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
325 |
! ! |
|
326 |
||
327 |
!JavaMonitor class methodsFor:'documentation'! |
|
328 |
||
329 |
version_SVN |
|
330 |
^ '$Id$' |
|
331 |
! ! |
|
1172 | 332 |
|
333 |
JavaMonitor initialize! |