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