/* * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
// Provides iteration over the list of NonJavaThreads. // List addition occurs in pre_run(), and removal occurs in post_run(), // so that only live fully-initialized threads can be found in the list. // Threads created after an iterator is constructed will not be visited // by the iterator. The scope of an iterator is a critical section; there // must be no safepoint checks in that scope. class NonJavaThread::Iterator : public StackObj {
uint _protect_enter;
NonJavaThread* _current;
// A base class for non-JavaThread subclasses with multiple // uniquely named instances. NamedThreads also provide a common // location to store GC information needed by GC threads // and the VMThread. class NamedThread: public NonJavaThread { friendclass VMStructs; enum {
max_name_len = 64
}; private: char* _name; // log Thread being processed by oops_do
Thread* _processed_thread;
uint _gc_id; // The current GC id when a thread takes part in GC
public:
NamedThread();
~NamedThread(); // May only be called once per thread. void set_name(constchar* format, ...) ATTRIBUTE_PRINTF(2, 3); virtualbool is_Named_thread() const { returntrue; } virtualconstchar* name() const { return _name == NULL ? "Unknown Thread" : _name; } virtualconstchar* type_name() const { return"NamedThread"; }
Thread *processed_thread() { return _processed_thread; } void set_processed_thread(Thread *thread) { _processed_thread = thread; } virtualvoid print_on(outputStream* st) const;
// A single WatcherThread is used for simulating timer interrupts. class WatcherThread: public NonJavaThread { friendclass VMStructs; protected: virtualvoid run();
private: static WatcherThread* _watcher_thread;
staticbool _startable; // volatile due to at least one lock-free read volatilestaticbool _should_terminate; public:
// Returns the single instance of WatcherThread static WatcherThread* watcher_thread() { return _watcher_thread; }
// Create and start the single instance of WatcherThread, or stop it on shutdown staticvoid start(); staticvoid stop(); // Only allow start once the VM is sufficiently initialized // Otherwise the first task to enroll will trigger the start staticvoid make_startable(); private: int sleep() const;
};
#endif// SHARE_RUNTIME_NONJAVATHREAD_HPP
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.