src/os/solaris/vm/osThread_solaris.hpp

Thu, 29 May 2014 09:56:06 -0700

author
asaha
date
Thu, 29 May 2014 09:56:06 -0700
changeset 6782
f73af4455d7d
parent 5237
f2110083203d
child 6876
710a3c8b516e
permissions
-rw-r--r--

Merge

duke@435 1 /*
sla@5237 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef OS_SOLARIS_VM_OSTHREAD_SOLARIS_HPP
stefank@2314 26 #define OS_SOLARIS_VM_OSTHREAD_SOLARIS_HPP
stefank@2314 27
duke@435 28 // This is embedded via include into the class OSThread
rbackman@3796 29 public:
rbackman@3796 30 typedef thread_t thread_id_t;
duke@435 31
duke@435 32 private:
phh@3481 33 uint _lwp_id; // lwp ID, only used with bound threads
phh@3481 34 int _native_priority; // Saved native priority when starting
phh@3481 35 // a bound thread
phh@3481 36 sigset_t _caller_sigmask; // Caller's signal mask
phh@3481 37 bool _vm_created_thread; // true if the VM created this thread,
phh@3481 38 // false if primary thread or attached thread
duke@435 39 public:
phh@3481 40 uint lwp_id() const { return _lwp_id; }
phh@3481 41 int native_priority() const { return _native_priority; }
duke@435 42
duke@435 43 // Set and get state of _vm_created_thread flag
duke@435 44 void set_vm_created() { _vm_created_thread = true; }
duke@435 45 bool is_vm_created() { return _vm_created_thread; }
duke@435 46
duke@435 47 // Methods to save/restore caller's signal mask
duke@435 48 sigset_t caller_sigmask() const { return _caller_sigmask; }
duke@435 49 void set_caller_sigmask(sigset_t sigmask) { _caller_sigmask = sigmask; }
duke@435 50
duke@435 51 #ifndef PRODUCT
duke@435 52 // Used for debugging, return a unique integer for each thread.
duke@435 53 int thread_identifier() const { return _thread_id; }
duke@435 54 #endif
duke@435 55 #ifdef ASSERT
duke@435 56 // On solaris reposition can fail in two ways:
duke@435 57 // 1: a mismatched pc, because signal is delivered too late, target thread
duke@435 58 // is resumed.
duke@435 59 // 2: on a timeout where signal is lost, target thread is resumed.
duke@435 60 bool valid_reposition_failure() {
duke@435 61 // only 1 and 2 can happen and we can handle both of them
duke@435 62 return true;
duke@435 63 }
duke@435 64 #endif
phh@3481 65 void set_lwp_id(uint id) { _lwp_id = id; }
phh@3481 66 void set_native_priority(int prio) { _native_priority = prio; }
duke@435 67
duke@435 68 // ***************************************************************
duke@435 69 // interrupt support. interrupts (using signals) are used to get
duke@435 70 // the thread context (get_thread_pc), to set the thread context
duke@435 71 // (set_thread_pc), and to implement java.lang.Thread.interrupt.
duke@435 72 // ***************************************************************
duke@435 73
duke@435 74 public:
sla@5237 75 os::SuspendResume sr;
duke@435 76
duke@435 77 private:
sla@5237 78 ucontext_t* _ucontext;
duke@435 79
duke@435 80 public:
sla@5237 81 ucontext_t* ucontext() const { return _ucontext; }
sla@5237 82 void set_ucontext(ucontext_t* ptr) { _ucontext = ptr; }
sla@5237 83 static void SR_handler(Thread* thread, ucontext_t* uc);
duke@435 84
duke@435 85 // ***************************************************************
duke@435 86 // java.lang.Thread.interrupt state.
duke@435 87 // ***************************************************************
duke@435 88
duke@435 89 private:
duke@435 90
duke@435 91 JavaThreadState _saved_interrupt_thread_state; // the thread state before a system call -- restored afterward
duke@435 92
duke@435 93 public:
duke@435 94
duke@435 95
duke@435 96 JavaThreadState saved_interrupt_thread_state() { return _saved_interrupt_thread_state; }
duke@435 97 void set_saved_interrupt_thread_state(JavaThreadState state) { _saved_interrupt_thread_state = state; }
duke@435 98
duke@435 99 static void handle_spinlock_contention(int tries); // Used for thread local eden locking
duke@435 100
duke@435 101 // ***************************************************************
duke@435 102 // Platform dependent initialization and cleanup
duke@435 103 // ***************************************************************
duke@435 104
duke@435 105 private:
duke@435 106
duke@435 107 void pd_initialize();
duke@435 108 void pd_destroy();
stefank@2314 109
stefank@2314 110 #endif // OS_SOLARIS_VM_OSTHREAD_SOLARIS_HPP

mercurial