comparison src/share/vm/utilities/taskqueue.cpp @ 342:37f87013dfd8

6711316: Open source the Garbage-First garbage collector Summary: First mercurial integration of the code for the Garbage-First garbage collector. Reviewed-by: apetrusenko, iveresov, jmasa, sgoldman, tonyp, ysr
author ysr
date Thu, 05 Jun 2008 15:57:56 -0700
parents a61af66fc99e
children 81cd571500b0
comparison
equal deleted inserted replaced
189:0b27f3512f9e 342:37f87013dfd8
63 63
64 void ParallelTaskTerminator::sleep(uint millis) { 64 void ParallelTaskTerminator::sleep(uint millis) {
65 os::sleep(Thread::current(), millis, false); 65 os::sleep(Thread::current(), millis, false);
66 } 66 }
67 67
68 bool ParallelTaskTerminator::offer_termination() { 68 bool
69 ParallelTaskTerminator::offer_termination(TerminatorTerminator* terminator) {
69 Atomic::inc(&_offered_termination); 70 Atomic::inc(&_offered_termination);
70 71
71 juint yield_count = 0; 72 juint yield_count = 0;
72 while (true) { 73 while (true) {
73 if (_offered_termination == _n_threads) { 74 if (_offered_termination == _n_threads) {
89 // which may only move the thread to the end of the this processor's 90 // which may only move the thread to the end of the this processor's
90 // runqueue). 91 // runqueue).
91 sleep(WorkStealingSleepMillis); 92 sleep(WorkStealingSleepMillis);
92 } 93 }
93 94
94 if (peek_in_queue_set()) { 95 if (peek_in_queue_set() ||
96 (terminator != NULL && terminator->should_exit_termination())) {
95 Atomic::dec(&_offered_termination); 97 Atomic::dec(&_offered_termination);
96 return false; 98 return false;
97 } 99 }
98 } 100 }
99 } 101 }