duke@435: /* sla@5237: * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * trims@1907: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA trims@1907: * or visit www.oracle.com if you need additional information or have any trims@1907: * questions. duke@435: * duke@435: */ duke@435: stefank@2314: #ifndef OS_LINUX_VM_OSTHREAD_LINUX_HPP stefank@2314: #define OS_LINUX_VM_OSTHREAD_LINUX_HPP rbackman@3796: public: rbackman@3796: typedef pid_t thread_id_t; stefank@2314: duke@435: private: duke@435: int _thread_type; duke@435: duke@435: public: duke@435: duke@435: int thread_type() const { duke@435: return _thread_type; duke@435: } duke@435: void set_thread_type(int type) { duke@435: _thread_type = type; duke@435: } duke@435: duke@435: // _pthread_id is the pthread id, which is used by library calls duke@435: // (e.g. pthread_kill). duke@435: pthread_t _pthread_id; duke@435: duke@435: sigset_t _caller_sigmask; // Caller's signal mask duke@435: duke@435: public: duke@435: duke@435: // Methods to save/restore caller's signal mask duke@435: sigset_t caller_sigmask() const { return _caller_sigmask; } duke@435: void set_caller_sigmask(sigset_t sigmask) { _caller_sigmask = sigmask; } duke@435: duke@435: #ifndef PRODUCT duke@435: // Used for debugging, return a unique integer for each thread. duke@435: int thread_identifier() const { return _thread_id; } duke@435: #endif duke@435: #ifdef ASSERT duke@435: // We expect no reposition failures so kill vm if we get one. duke@435: // duke@435: bool valid_reposition_failure() { duke@435: return false; duke@435: } duke@435: #endif // ASSERT duke@435: pthread_t pthread_id() const { duke@435: return _pthread_id; duke@435: } duke@435: void set_pthread_id(pthread_t tid) { duke@435: _pthread_id = tid; duke@435: } duke@435: duke@435: // *************************************************************** duke@435: // suspension support. duke@435: // *************************************************************** duke@435: duke@435: public: duke@435: // flags that support signal based suspend/resume on Linux are in a duke@435: // separate class to avoid confusion with many flags in OSThread that duke@435: // are used by VM level suspend/resume. sla@5237: os::SuspendResume sr; duke@435: duke@435: // _ucontext and _siginfo are used by SR_handler() to save thread context, duke@435: // and they will later be used to walk the stack or reposition thread PC. duke@435: // If the thread is not suspended in SR_handler() (e.g. self suspend), duke@435: // the value in _ucontext is meaningless, so we must use the last Java duke@435: // frame information as the frame. This will mean that for threads duke@435: // that are parked on a mutex the profiler (and safepoint mechanism) duke@435: // will see the thread as if it were still in the Java frame. This duke@435: // not a problem for the profiler since the Java frame is a close duke@435: // enough result. For the safepoint mechanism when the give it the duke@435: // Java frame we are not at a point where the safepoint needs the duke@435: // frame to that accurate (like for a compiled safepoint) since we duke@435: // should be in a place where we are native and will block ourselves duke@435: // if we transition. duke@435: private: duke@435: void* _siginfo; duke@435: ucontext_t* _ucontext; duke@435: int _expanding_stack; /* non zero if manually expanding stack */ duke@435: address _alt_sig_stack; /* address of base of alternate signal stack */ duke@435: duke@435: public: duke@435: void* siginfo() const { return _siginfo; } duke@435: void set_siginfo(void* ptr) { _siginfo = ptr; } duke@435: ucontext_t* ucontext() const { return _ucontext; } duke@435: void set_ucontext(ucontext_t* ptr) { _ucontext = ptr; } duke@435: void set_expanding_stack(void) { _expanding_stack = 1; } duke@435: void clear_expanding_stack(void) { _expanding_stack = 0; } duke@435: int expanding_stack(void) { return _expanding_stack; } duke@435: duke@435: void set_alt_sig_stack(address val) { _alt_sig_stack = val; } duke@435: address alt_sig_stack(void) { return _alt_sig_stack; } duke@435: duke@435: private: duke@435: Monitor* _startThread_lock; // sync parent and child in thread creation duke@435: duke@435: public: duke@435: duke@435: Monitor* startThread_lock() const { duke@435: return _startThread_lock; duke@435: } duke@435: duke@435: // *************************************************************** duke@435: // Platform dependent initialization and cleanup duke@435: // *************************************************************** duke@435: duke@435: private: duke@435: duke@435: void pd_initialize(); duke@435: void pd_destroy(); duke@435: duke@435: // Reconciliation History duke@435: // osThread_solaris.hpp 1.24 99/08/27 13:11:54 duke@435: // End stefank@2314: stefank@2314: #endif // OS_LINUX_VM_OSTHREAD_LINUX_HPP