462 assert(0 <= t && t < _n_tasks, "bad task id."); |
462 assert(0 <= t && t < _n_tasks, "bad task id."); |
463 uint old = _tasks[t]; |
463 uint old = _tasks[t]; |
464 if (old == 0) { |
464 if (old == 0) { |
465 old = Atomic::cmpxchg(1, &_tasks[t], 0); |
465 old = Atomic::cmpxchg(1, &_tasks[t], 0); |
466 } |
466 } |
467 assert(_tasks[t] == 1, "What else?"); |
|
468 bool res = old != 0; |
467 bool res = old != 0; |
469 #ifdef ASSERT |
468 #ifdef ASSERT |
470 if (!res) { |
469 if (!res) { |
471 assert(_claimed < _n_tasks, "Too many tasks claimed; missing clear?"); |
470 assert(_claimed < _n_tasks, "Too many tasks claimed; missing clear?"); |
472 Atomic::inc((volatile jint*) &_claimed); |
471 Atomic::inc((volatile jint*) &_claimed); |