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