Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/os/solaris/vm/osThread_solaris.hpp
32285 views
/*1* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef OS_SOLARIS_VM_OSTHREAD_SOLARIS_HPP25#define OS_SOLARIS_VM_OSTHREAD_SOLARIS_HPP2627// This is embedded via include into the class OSThread28public:29typedef thread_t thread_id_t;3031private:32uint _lwp_id; // lwp ID, only used with bound threads33int _native_priority; // Saved native priority when starting34// a bound thread35sigset_t _caller_sigmask; // Caller's signal mask36bool _vm_created_thread; // true if the VM created this thread,37// false if primary thread or attached thread38public:39uint lwp_id() const { return _lwp_id; }40int native_priority() const { return _native_priority; }4142// Set and get state of _vm_created_thread flag43void set_vm_created() { _vm_created_thread = true; }44bool is_vm_created() { return _vm_created_thread; }4546// Methods to save/restore caller's signal mask47sigset_t caller_sigmask() const { return _caller_sigmask; }48void set_caller_sigmask(sigset_t sigmask) { _caller_sigmask = sigmask; }4950#ifndef PRODUCT51// Used for debugging, return a unique integer for each thread.52int thread_identifier() const { return _thread_id; }53#endif54#ifdef ASSERT55// On solaris reposition can fail in two ways:56// 1: a mismatched pc, because signal is delivered too late, target thread57// is resumed.58// 2: on a timeout where signal is lost, target thread is resumed.59bool valid_reposition_failure() {60// only 1 and 2 can happen and we can handle both of them61return true;62}63#endif64void set_lwp_id(uint id) { _lwp_id = id; }65void set_native_priority(int prio) { _native_priority = prio; }6667// ***************************************************************68// interrupt support. interrupts (using signals) are used to get69// the thread context (get_thread_pc), to set the thread context70// (set_thread_pc), and to implement java.lang.Thread.interrupt.71// ***************************************************************7273public:74os::SuspendResume sr;7576private:77ucontext_t* _ucontext;7879public:80ucontext_t* ucontext() const { return _ucontext; }81void set_ucontext(ucontext_t* ptr) { _ucontext = ptr; }82static void SR_handler(Thread* thread, ucontext_t* uc);8384// ***************************************************************85// java.lang.Thread.interrupt state.86// ***************************************************************8788private:8990JavaThreadState _saved_interrupt_thread_state; // the thread state before a system call -- restored afterward9192public:939495JavaThreadState saved_interrupt_thread_state() { return _saved_interrupt_thread_state; }96void set_saved_interrupt_thread_state(JavaThreadState state) { _saved_interrupt_thread_state = state; }9798static void handle_spinlock_contention(int tries); // Used for thread local eden locking99100// ***************************************************************101// Platform dependent initialization and cleanup102// ***************************************************************103104private:105106void pd_initialize();107void pd_destroy();108109#endif // OS_SOLARIS_VM_OSTHREAD_SOLARIS_HPP110111112