< prev index next >

src/hotspot/share/runtime/threads.hpp

Print this page

  1 /*
  2  * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
  3  * Copyright (c) 2021, Azul Systems, Inc. All rights reserved.
  4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5  *
  6  * This code is free software; you can redistribute it and/or modify it
  7  * under the terms of the GNU General Public License version 2 only, as
  8  * published by the Free Software Foundation.
  9  *
 10  * This code is distributed in the hope that it will be useful, but WITHOUT
 11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 13  * version 2 for more details (a copy is included in the LICENSE file that
 14  * accompanied this code).
 15  *
 16  * You should have received a copy of the GNU General Public License version
 17  * 2 along with this work; if not, write to the Free Software Foundation,
 18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 19  *
 20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 21  * or visit www.oracle.com if you need additional information or have any
 22  * questions.

 39 class outputStream;
 40 
 41 class CodeBlobClosure;
 42 class MetadataClosure;
 43 class OopClosure;
 44 
 45 // The active thread queue. It also keeps track of the current used
 46 // thread priorities.
 47 class Threads: AllStatic {
 48   friend class VMStructs;
 49  private:
 50   static int         _number_of_threads;
 51   static int         _number_of_non_daemon_threads;
 52   static int         _return_code;
 53   static uintx       _thread_claim_token;
 54 #ifdef ASSERT
 55   static bool        _vm_complete;
 56 #endif
 57 
 58   static void initialize_java_lang_classes(JavaThread* main_thread, TRAPS);

 59   static void initialize_jsr292_core_classes(TRAPS);
 60 
 61  public:
 62   // Thread management
 63   // force_daemon is a concession to JNI, where we may need to add a
 64   // thread to the thread list before allocating its thread object
 65   static void add(JavaThread* p, bool force_daemon = false);
 66   static void remove(JavaThread* p, bool is_daemon);
 67   static void non_java_threads_do(ThreadClosure* tc);
 68   static void java_threads_do(ThreadClosure* tc);
 69   static void threads_do(ThreadClosure* tc);
 70   static void possibly_parallel_threads_do(bool is_par, ThreadClosure* tc);
 71 
 72   // Initializes the vm and creates the vm thread
 73   static jint create_vm(JavaVMInitArgs* args, bool* canTryAgain);
 74   static void convert_vm_init_libraries_to_agents();
 75   static void create_vm_init_libraries();
 76   static void create_vm_init_agents();
 77   static void shutdown_vm_agents();
 78   static void destroy_vm();

  1 /*
  2  * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
  3  * Copyright (c) 2021, Azul Systems, Inc. All rights reserved.
  4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5  *
  6  * This code is free software; you can redistribute it and/or modify it
  7  * under the terms of the GNU General Public License version 2 only, as
  8  * published by the Free Software Foundation.
  9  *
 10  * This code is distributed in the hope that it will be useful, but WITHOUT
 11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 13  * version 2 for more details (a copy is included in the LICENSE file that
 14  * accompanied this code).
 15  *
 16  * You should have received a copy of the GNU General Public License version
 17  * 2 along with this work; if not, write to the Free Software Foundation,
 18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 19  *
 20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 21  * or visit www.oracle.com if you need additional information or have any
 22  * questions.

 39 class outputStream;
 40 
 41 class CodeBlobClosure;
 42 class MetadataClosure;
 43 class OopClosure;
 44 
 45 // The active thread queue. It also keeps track of the current used
 46 // thread priorities.
 47 class Threads: AllStatic {
 48   friend class VMStructs;
 49  private:
 50   static int         _number_of_threads;
 51   static int         _number_of_non_daemon_threads;
 52   static int         _return_code;
 53   static uintx       _thread_claim_token;
 54 #ifdef ASSERT
 55   static bool        _vm_complete;
 56 #endif
 57 
 58   static void initialize_java_lang_classes(JavaThread* main_thread, TRAPS);
 59   static bool initialize_compilation(TRAPS);
 60   static void initialize_jsr292_core_classes(TRAPS);
 61 
 62  public:
 63   // Thread management
 64   // force_daemon is a concession to JNI, where we may need to add a
 65   // thread to the thread list before allocating its thread object
 66   static void add(JavaThread* p, bool force_daemon = false);
 67   static void remove(JavaThread* p, bool is_daemon);
 68   static void non_java_threads_do(ThreadClosure* tc);
 69   static void java_threads_do(ThreadClosure* tc);
 70   static void threads_do(ThreadClosure* tc);
 71   static void possibly_parallel_threads_do(bool is_par, ThreadClosure* tc);
 72 
 73   // Initializes the vm and creates the vm thread
 74   static jint create_vm(JavaVMInitArgs* args, bool* canTryAgain);
 75   static void convert_vm_init_libraries_to_agents();
 76   static void create_vm_init_libraries();
 77   static void create_vm_init_agents();
 78   static void shutdown_vm_agents();
 79   static void destroy_vm();
< prev index next >