src/os/solaris/vm/osThread_solaris.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot-rt-fx60 Sdiff src/os/solaris/vm

src/os/solaris/vm/osThread_solaris.hpp

Print this page




  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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef OS_SOLARIS_VM_OSTHREAD_SOLARIS_HPP
  26 #define OS_SOLARIS_VM_OSTHREAD_SOLARIS_HPP
  27 
  28 // This is embedded via include into the class OSThread
  29 
  30  private:
  31 
  32   thread_t _thread_id;      // Solaris thread id
  33   unsigned int  _lwp_id;    // lwp ID, only used with bound threads


  34   sigset_t _caller_sigmask; // Caller's signal mask
  35   bool _vm_created_thread;  // true if the VM create this thread
  36                             // false if primary thread or attached thread
  37  public:
  38 
  39   thread_t thread_id() const      { return _thread_id; }


  40 
  41   unsigned int lwp_id() const     { return _lwp_id; }
  42 
  43   // Set and get state of _vm_created_thread flag
  44   void set_vm_created()           { _vm_created_thread = true; }
  45   bool is_vm_created()            { return _vm_created_thread; }
  46 
  47   // Methods to save/restore caller's signal mask
  48   sigset_t  caller_sigmask() const       { return _caller_sigmask; }
  49   void    set_caller_sigmask(sigset_t sigmask)  { _caller_sigmask = sigmask; }
  50 
  51 #ifndef PRODUCT
  52   // Used for debugging, return a unique integer for each thread.
  53   int thread_identifier() const   { return _thread_id; }
  54 #endif
  55 #ifdef ASSERT
  56   // On solaris reposition can fail in two ways:
  57   // 1: a mismatched pc, because signal is delivered too late, target thread
  58   //    is resumed.
  59   // 2: on a timeout where signal is lost, target thread is resumed.
  60   bool valid_reposition_failure() {
  61     // only 1 and 2 can happen and we can handle both of them
  62     return true;
  63   }
  64 #endif
  65   void set_thread_id(thread_t id) { _thread_id = id;   }
  66   void set_lwp_id(unsigned int id){ _lwp_id = id;   }

  67 
  68  // ***************************************************************
  69  // interrupt support.  interrupts (using signals) are used to get
  70  // the thread context (get_thread_pc), to set the thread context
  71  // (set_thread_pc), and to implement java.lang.Thread.interrupt.
  72  // ***************************************************************
  73 
  74  public:
  75 
  76   class InterruptArguments : StackObj {
  77    private:
  78     Thread*     _thread;   // the thread to signal was dispatched to
  79     ucontext_t* _ucontext; // the machine context at the time of the signal
  80 
  81    public:
  82     InterruptArguments(Thread* thread, ucontext_t* ucontext) {
  83       _thread   = thread;
  84       _ucontext = ucontext;
  85     }
  86 




  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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef OS_SOLARIS_VM_OSTHREAD_SOLARIS_HPP
  26 #define OS_SOLARIS_VM_OSTHREAD_SOLARIS_HPP
  27 
  28 // This is embedded via include into the class OSThread
  29 
  30  private:

  31   thread_t _thread_id;         // Solaris thread id
  32   uint     _lwp_id;            // lwp ID, only used with bound threads
  33   int      _native_priority;   // Saved native priority when starting
  34                                // a bound thread
  35   sigset_t _caller_sigmask;    // Caller's signal mask
  36   bool     _vm_created_thread; // true if the VM create this thread,
  37                                // false if primary thread or attached thread
  38  public:

  39   thread_t thread_id() const       { return _thread_id; }
  40   uint     lwp_id() const          { return _lwp_id; }
  41   int      native_priority() const { return _native_priority; }
  42 


  43   // Set and get state of _vm_created_thread flag
  44   void set_vm_created()           { _vm_created_thread = true; }
  45   bool is_vm_created()            { return _vm_created_thread; }
  46 
  47   // Methods to save/restore caller's signal mask
  48   sigset_t  caller_sigmask() const       { return _caller_sigmask; }
  49   void    set_caller_sigmask(sigset_t sigmask)  { _caller_sigmask = sigmask; }
  50 
  51 #ifndef PRODUCT
  52   // Used for debugging, return a unique integer for each thread.
  53   int thread_identifier() const   { return _thread_id; }
  54 #endif
  55 #ifdef ASSERT
  56   // On solaris reposition can fail in two ways:
  57   // 1: a mismatched pc, because signal is delivered too late, target thread
  58   //    is resumed.
  59   // 2: on a timeout where signal is lost, target thread is resumed.
  60   bool valid_reposition_failure() {
  61     // only 1 and 2 can happen and we can handle both of them
  62     return true;
  63   }
  64 #endif
  65   void set_thread_id(thread_t id)    { _thread_id = id; }
  66   void set_lwp_id(uint id)           { _lwp_id = id; }
  67   void set_native_priority(int prio) { _native_priority = prio; }
  68 
  69  // ***************************************************************
  70  // interrupt support.  interrupts (using signals) are used to get
  71  // the thread context (get_thread_pc), to set the thread context
  72  // (set_thread_pc), and to implement java.lang.Thread.interrupt.
  73  // ***************************************************************
  74 
  75  public:
  76 
  77   class InterruptArguments : StackObj {
  78    private:
  79     Thread*     _thread;   // the thread to signal was dispatched to
  80     ucontext_t* _ucontext; // the machine context at the time of the signal
  81 
  82    public:
  83     InterruptArguments(Thread* thread, ucontext_t* ucontext) {
  84       _thread   = thread;
  85       _ucontext = ucontext;
  86     }
  87 


src/os/solaris/vm/osThread_solaris.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File