src/os/bsd/vm/osThread_bsd.hpp

Tue, 29 Apr 2014 15:17:27 +0200

author
goetz
date
Tue, 29 Apr 2014 15:17:27 +0200
changeset 6911
ce8f6bb717c9
parent 5834
faff125a1ead
child 6876
710a3c8b516e
permissions
-rw-r--r--

8042195: Introduce umbrella header orderAccess.inline.hpp.
Reviewed-by: dholmes, kvn, stefank, twisti

never@3156 1 /*
sla@5237 2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
never@3156 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
never@3156 4 *
never@3156 5 * This code is free software; you can redistribute it and/or modify it
never@3156 6 * under the terms of the GNU General Public License version 2 only, as
never@3156 7 * published by the Free Software Foundation.
never@3156 8 *
never@3156 9 * This code is distributed in the hope that it will be useful, but WITHOUT
never@3156 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
never@3156 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
never@3156 12 * version 2 for more details (a copy is included in the LICENSE file that
never@3156 13 * accompanied this code).
never@3156 14 *
never@3156 15 * You should have received a copy of the GNU General Public License version
never@3156 16 * 2 along with this work; if not, write to the Free Software Foundation,
never@3156 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
never@3156 18 *
never@3156 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
never@3156 20 * or visit www.oracle.com if you need additional information or have any
never@3156 21 * questions.
never@3156 22 *
never@3156 23 */
never@3156 24
never@3156 25 #ifndef OS_BSD_VM_OSTHREAD_BSD_HPP
never@3156 26 #define OS_BSD_VM_OSTHREAD_BSD_HPP
never@3156 27
never@3156 28 private:
never@3156 29 int _thread_type;
never@3156 30
never@3156 31 public:
never@3156 32
never@3156 33 int thread_type() const {
never@3156 34 return _thread_type;
never@3156 35 }
never@3156 36 void set_thread_type(int type) {
never@3156 37 _thread_type = type;
never@3156 38 }
never@3156 39
never@3156 40 private:
never@3156 41
sla@3587 42 #ifdef __APPLE__
rbackman@3796 43 typedef thread_t thread_id_t;
sla@3587 44 #else
dsamersoff@5834 45 typedef pid_t thread_id_t;
rbackman@3796 46 #endif
rbackman@3796 47
sla@3587 48 // _pthread_id is the pthread id, which is used by library calls
sla@3587 49 // (e.g. pthread_kill).
never@3156 50 pthread_t _pthread_id;
sla@3587 51
sla@4564 52 // This is the "thread_id" from struct thread_identifier_info. According to a
sla@4564 53 // comment in thread_info.h, this is a "system-wide unique 64-bit thread id".
sla@4564 54 // The value is used by SA to correlate threads.
sla@4564 55 uint64_t _unique_thread_id;
sla@4564 56
never@3156 57 sigset_t _caller_sigmask; // Caller's signal mask
never@3156 58
never@3156 59 public:
never@3156 60
never@3156 61 // Methods to save/restore caller's signal mask
never@3156 62 sigset_t caller_sigmask() const { return _caller_sigmask; }
never@3156 63 void set_caller_sigmask(sigset_t sigmask) { _caller_sigmask = sigmask; }
never@3156 64
never@3156 65 #ifndef PRODUCT
never@3156 66 // Used for debugging, return a unique integer for each thread.
never@3156 67 intptr_t thread_identifier() const { return (intptr_t)_pthread_id; }
never@3156 68 #endif
rbackman@3796 69
never@3156 70 #ifdef ASSERT
never@3156 71 // We expect no reposition failures so kill vm if we get one.
never@3156 72 //
never@3156 73 bool valid_reposition_failure() {
never@3156 74 return false;
never@3156 75 }
never@3156 76 #endif // ASSERT
rbackman@3796 77
never@3156 78 pthread_t pthread_id() const {
never@3156 79 return _pthread_id;
never@3156 80 }
never@3156 81 void set_pthread_id(pthread_t tid) {
never@3156 82 _pthread_id = tid;
never@3156 83 }
never@3156 84
sla@4564 85 void set_unique_thread_id(uint64_t id) {
sla@4564 86 _unique_thread_id = id;
sla@4564 87 }
sla@4564 88
never@3156 89 // ***************************************************************
never@3156 90 // suspension support.
never@3156 91 // ***************************************************************
never@3156 92
never@3156 93 public:
never@3156 94 // flags that support signal based suspend/resume on Bsd are in a
never@3156 95 // separate class to avoid confusion with many flags in OSThread that
never@3156 96 // are used by VM level suspend/resume.
sla@5237 97 os::SuspendResume sr;
never@3156 98
never@3156 99 // _ucontext and _siginfo are used by SR_handler() to save thread context,
never@3156 100 // and they will later be used to walk the stack or reposition thread PC.
never@3156 101 // If the thread is not suspended in SR_handler() (e.g. self suspend),
never@3156 102 // the value in _ucontext is meaningless, so we must use the last Java
never@3156 103 // frame information as the frame. This will mean that for threads
never@3156 104 // that are parked on a mutex the profiler (and safepoint mechanism)
never@3156 105 // will see the thread as if it were still in the Java frame. This
never@3156 106 // not a problem for the profiler since the Java frame is a close
never@3156 107 // enough result. For the safepoint mechanism when the give it the
never@3156 108 // Java frame we are not at a point where the safepoint needs the
never@3156 109 // frame to that accurate (like for a compiled safepoint) since we
never@3156 110 // should be in a place where we are native and will block ourselves
never@3156 111 // if we transition.
never@3156 112 private:
never@3156 113 void* _siginfo;
never@3156 114 ucontext_t* _ucontext;
never@3156 115 int _expanding_stack; /* non zero if manually expanding stack */
never@3156 116 address _alt_sig_stack; /* address of base of alternate signal stack */
never@3156 117
never@3156 118 public:
never@3156 119 void* siginfo() const { return _siginfo; }
never@3156 120 void set_siginfo(void* ptr) { _siginfo = ptr; }
never@3156 121 ucontext_t* ucontext() const { return _ucontext; }
never@3156 122 void set_ucontext(ucontext_t* ptr) { _ucontext = ptr; }
never@3156 123 void set_expanding_stack(void) { _expanding_stack = 1; }
never@3156 124 void clear_expanding_stack(void) { _expanding_stack = 0; }
never@3156 125 int expanding_stack(void) { return _expanding_stack; }
never@3156 126
never@3156 127 void set_alt_sig_stack(address val) { _alt_sig_stack = val; }
never@3156 128 address alt_sig_stack(void) { return _alt_sig_stack; }
never@3156 129
never@3156 130 private:
never@3156 131 Monitor* _startThread_lock; // sync parent and child in thread creation
never@3156 132
never@3156 133 public:
never@3156 134
never@3156 135 Monitor* startThread_lock() const {
never@3156 136 return _startThread_lock;
never@3156 137 }
never@3156 138
never@3156 139 // ***************************************************************
never@3156 140 // Platform dependent initialization and cleanup
never@3156 141 // ***************************************************************
never@3156 142
never@3156 143 private:
never@3156 144
never@3156 145 void pd_initialize();
never@3156 146 void pd_destroy();
never@3156 147
never@3156 148 // Reconciliation History
never@3156 149 // osThread_solaris.hpp 1.24 99/08/27 13:11:54
never@3156 150 // End
never@3156 151
never@3156 152 #endif // OS_BSD_VM_OSTHREAD_BSD_HPP

mercurial