equal
deleted
inserted
replaced
287 * mode requires a lock but we use only a simple spinlock (using |
287 * mode requires a lock but we use only a simple spinlock (using |
288 * field qlock), because submitters encountering a busy queue move |
288 * field qlock), because submitters encountering a busy queue move |
289 * on to try or create other queues -- they block only when |
289 * on to try or create other queues -- they block only when |
290 * creating and registering new queues. Because it is used only as |
290 * creating and registering new queues. Because it is used only as |
291 * a spinlock, unlocking requires only a "releasing" store (using |
291 * a spinlock, unlocking requires only a "releasing" store (using |
292 * putOrderedInt). The qlock is also used during termination |
292 * putIntRelease). The qlock is also used during termination |
293 * detection, in which case it is forced to a negative |
293 * detection, in which case it is forced to a negative |
294 * non-lockable value. |
294 * non-lockable value. |
295 * |
295 * |
296 * Management |
296 * Management |
297 * ========== |
297 * ========== |
1069 if (top == s + 1 && array == a && |
1069 if (top == s + 1 && array == a && |
1070 U.compareAndSwapObject(a, offset, task, null)) { |
1070 U.compareAndSwapObject(a, offset, task, null)) { |
1071 popped = true; |
1071 popped = true; |
1072 top = s; |
1072 top = s; |
1073 } |
1073 } |
1074 U.putOrderedInt(this, QLOCK, 0); |
1074 U.putIntRelease(this, QLOCK, 0); |
1075 } |
1075 } |
1076 } |
1076 } |
1077 return popped; |
1077 return popped; |
1078 } |
1078 } |
1079 |
1079 |
1259 U.compareAndSwapObject(a, offset, |
1259 U.compareAndSwapObject(a, offset, |
1260 t, null)) { |
1260 t, null)) { |
1261 popped = true; |
1261 popped = true; |
1262 top = s - 1; |
1262 top = s - 1; |
1263 } |
1263 } |
1264 U.putOrderedInt(this, QLOCK, 0); |
1264 U.putIntRelease(this, QLOCK, 0); |
1265 if (popped) |
1265 if (popped) |
1266 return t; |
1266 return t; |
1267 } |
1267 } |
1268 } |
1268 } |
1269 else if (U.compareAndSwapObject(a, offset, |
1269 else if (U.compareAndSwapObject(a, offset, |