100 |
|
if (done != null) |
101 |
|
done.signal(); |
102 |
|
return true; |
103 |
< |
} |
104 |
< |
else // taker has cancelled |
103 |
> |
} else // taker has cancelled |
104 |
|
return false; |
105 |
< |
} |
107 |
< |
finally { |
105 |
> |
} finally { |
106 |
|
this.unlock(); |
107 |
|
} |
108 |
|
} |
121 |
|
if (done != null) |
122 |
|
done.signal(); |
123 |
|
return x; |
124 |
< |
} |
127 |
< |
else |
124 |
> |
} else |
125 |
|
return null; |
126 |
< |
} |
130 |
< |
finally { |
126 |
> |
} finally { |
127 |
|
this.unlock(); |
128 |
|
} |
129 |
|
} |
150 |
|
else |
151 |
|
done.await(); |
152 |
|
} |
153 |
< |
} |
158 |
< |
catch (InterruptedException ie) { |
153 |
> |
} catch (InterruptedException ie) { |
154 |
|
// If taken, return normally but set interrupt status |
155 |
|
if (item == null) { |
156 |
|
Thread.currentThread().interrupt(); |
157 |
|
return true; |
158 |
< |
} |
164 |
< |
else { |
158 |
> |
} else { |
159 |
|
item = CANCELLED; |
160 |
|
done.signal(); // propagate signal |
161 |
|
throw ie; |
162 |
|
} |
163 |
< |
} |
170 |
< |
finally { |
163 |
> |
} finally { |
164 |
|
this.unlock(); |
165 |
|
} |
166 |
|
} |
191 |
|
else |
192 |
|
done.await(); |
193 |
|
} |
194 |
< |
} |
202 |
< |
catch (InterruptedException ie) { |
194 |
> |
} catch (InterruptedException ie) { |
195 |
|
Object y = item; |
196 |
|
if (y != null) { |
197 |
|
item = null; |
198 |
|
next = null; |
199 |
|
Thread.currentThread().interrupt(); |
200 |
|
return y; |
201 |
< |
} |
210 |
< |
else { |
201 |
> |
} else { |
202 |
|
item = CANCELLED; |
203 |
|
done.signal(); // propagate signal |
204 |
|
throw ie; |
205 |
|
} |
206 |
< |
} |
216 |
< |
finally { |
206 |
> |
} finally { |
207 |
|
this.unlock(); |
208 |
|
} |
209 |
|
} |
247 |
|
node = waitingTakes.deq(); |
248 |
|
if ( (mustWait = (node == null)) ) |
249 |
|
node = waitingPuts.enq(x); |
250 |
< |
} |
261 |
< |
finally { |
250 |
> |
} finally { |
251 |
|
qlock.unlock(); |
252 |
|
} |
253 |
|
|
274 |
|
node = waitingPuts.deq(); |
275 |
|
if ( (mustWait = (node == null)) ) |
276 |
|
node = waitingTakes.enq(null); |
277 |
< |
} |
289 |
< |
finally { |
277 |
> |
} finally { |
278 |
|
qlock.unlock(); |
279 |
|
} |
280 |
|
|
351 |
|
Node node; |
352 |
|
try { |
353 |
|
node = waitingTakes.deq(); |
354 |
< |
} |
367 |
< |
finally { |
354 |
> |
} finally { |
355 |
|
qlock.unlock(); |
356 |
|
} |
357 |
|
if (node == null) |
370 |
|
qlock.lock(); |
371 |
|
try { |
372 |
|
node = waitingPuts.deq(); |
373 |
< |
} |
387 |
< |
finally { |
373 |
> |
} finally { |
374 |
|
qlock.unlock(); |
375 |
|
} |
376 |
|
if (node == null) |