41 }
42 }
43 return false;
44 }
45
46 bool AbstractCompiler::should_perform_shutdown() {
47 // Since this method can be called by multiple threads, the lock ensures atomicity of
48 // decrementing '_num_compiler_threads' and the following operations.
49 MutexLocker only_one(CompileThread_lock);
50 _num_compiler_threads--;
51 assert (CompileBroker::is_compilation_disabled_forever(), "Must be set, otherwise thread waits forever");
52
53 // Only the last thread will perform shutdown operations
54 if (_num_compiler_threads == 0) {
55 return true;
56 }
57 return false;
58 }
59
60 void AbstractCompiler::set_state(int state) {
61 // Ensure that ste is only set by one thread at a time
62 MutexLocker only_one(CompileThread_lock);
63 _compiler_state = state;
64 CompileThread_lock->notify_all();
65 }
|
41 }
42 }
43 return false;
44 }
45
46 bool AbstractCompiler::should_perform_shutdown() {
47 // Since this method can be called by multiple threads, the lock ensures atomicity of
48 // decrementing '_num_compiler_threads' and the following operations.
49 MutexLocker only_one(CompileThread_lock);
50 _num_compiler_threads--;
51 assert (CompileBroker::is_compilation_disabled_forever(), "Must be set, otherwise thread waits forever");
52
53 // Only the last thread will perform shutdown operations
54 if (_num_compiler_threads == 0) {
55 return true;
56 }
57 return false;
58 }
59
60 void AbstractCompiler::set_state(int state) {
61 // Ensure that state is only set by one thread at a time
62 MutexLocker only_one(CompileThread_lock);
63 _compiler_state = state;
64 CompileThread_lock->notify_all();
65 }
|