< prev index next >

src/os/aix/vm/osThread_aix.hpp

Print this page
rev 9449 : 8143125-Further Developments for AIX


  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *
  24  */
  25 
  26 #ifndef OS_AIX_VM_OSTHREAD_AIX_HPP
  27 #define OS_AIX_VM_OSTHREAD_AIX_HPP
  28 
  29  public:
  30   typedef pid_t thread_id_t;
  31 
  32  private:
  33   int _thread_type;
  34 
  35  public:
  36 
  37   int thread_type() const {
  38     return _thread_type;
  39   }
  40   void set_thread_type(int type) {
  41     _thread_type = type;
  42   }
  43 
  44  private:
  45 
  46   // _pthread_id is the pthread id, which is used by library calls
  47   // (e.g. pthread_kill).
  48   pthread_t _pthread_id;




  49 
  50   sigset_t _caller_sigmask; // Caller's signal mask
  51 
  52  public:
  53 
  54   // Methods to save/restore caller's signal mask
  55   sigset_t  caller_sigmask() const       { return _caller_sigmask; }
  56   void    set_caller_sigmask(sigset_t sigmask)  { _caller_sigmask = sigmask; }
  57 
  58 #ifndef PRODUCT
  59   // Used for debugging, return a unique integer for each thread.
  60   int thread_identifier() const   { return _thread_id; }
  61 #endif
  62 #ifdef ASSERT
  63   // We expect no reposition failures so kill vm if we get one.
  64   //
  65   bool valid_reposition_failure() {
  66     return false;
  67   }
  68 #endif // ASSERT
  69   pthread_t pthread_id() const {
  70     return _pthread_id;



  71   }
  72   void set_pthread_id(pthread_t tid) {
  73     _pthread_id = tid;


  74   }
  75 
  76   // ***************************************************************
  77   // suspension support.
  78   // ***************************************************************
  79 
  80  public:
  81   // flags that support signal based suspend/resume on Linux are in a
  82   // separate class to avoid confusion with many flags in OSThread that
  83   // are used by VM level suspend/resume.
  84   os::SuspendResume sr;
  85 
  86   // _ucontext and _siginfo are used by SR_handler() to save thread context,
  87   // and they will later be used to walk the stack or reposition thread PC.
  88   // If the thread is not suspended in SR_handler() (e.g. self suspend),
  89   // the value in _ucontext is meaningless, so we must use the last Java
  90   // frame information as the frame. This will mean that for threads
  91   // that are parked on a mutex the profiler (and safepoint mechanism)
  92   // will see the thread as if it were still in the Java frame. This
  93   // not a problem for the profiler since the Java frame is a close




  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *
  24  */
  25 
  26 #ifndef OS_AIX_VM_OSTHREAD_AIX_HPP
  27 #define OS_AIX_VM_OSTHREAD_AIX_HPP
  28 
  29  public:
  30   typedef pthread_t thread_id_t;
  31 
  32  private:
  33   int _thread_type;
  34 
  35  public:
  36 
  37   int thread_type() const {
  38     return _thread_type;
  39   }
  40   void set_thread_type(int type) {
  41     _thread_type = type;
  42   }
  43 
  44  private:
  45 
  46   // On AIX, we use the pthread id as OSThread::thread_id and keep the kernel thread id
  47   // separately for diagnostic purposes.
  48   //
  49   // Note: this kernel thread id is saved at thread start. Depending on the
  50   // AIX scheduling mode, this may not be the current thread id (usually not
  51   // a problem though as we run with AIXTHREAD_SCOPE=S).
  52   tid_t _kernel_thread_id;
  53 
  54   sigset_t _caller_sigmask; // Caller's signal mask
  55 
  56  public:
  57 
  58   // Methods to save/restore caller's signal mask
  59   sigset_t  caller_sigmask() const       { return _caller_sigmask; }
  60   void    set_caller_sigmask(sigset_t sigmask)  { _caller_sigmask = sigmask; }
  61 
  62 #ifndef PRODUCT
  63   // Used for debugging, return a unique integer for each thread.
  64   int thread_identifier() const   { return _thread_id; }
  65 #endif
  66 #ifdef ASSERT
  67   // We expect no reposition failures so kill vm if we get one.
  68   //
  69   bool valid_reposition_failure() {
  70     return false;
  71   }
  72 #endif // ASSERT
  73   tid_t kernel_thread_id() const {
  74     return _kernel_thread_id;
  75   }
  76   void set_kernel_thread_id(tid_t tid) {
  77     _kernel_thread_id = tid;
  78   }
  79 
  80   pthread_t pthread_id() const {
  81     // Here: same as OSThread::thread_id()
  82     return _thread_id;
  83   }
  84 
  85   // ***************************************************************
  86   // suspension support.
  87   // ***************************************************************
  88 
  89  public:
  90   // flags that support signal based suspend/resume on Linux are in a
  91   // separate class to avoid confusion with many flags in OSThread that
  92   // are used by VM level suspend/resume.
  93   os::SuspendResume sr;
  94 
  95   // _ucontext and _siginfo are used by SR_handler() to save thread context,
  96   // and they will later be used to walk the stack or reposition thread PC.
  97   // If the thread is not suspended in SR_handler() (e.g. self suspend),
  98   // the value in _ucontext is meaningless, so we must use the last Java
  99   // frame information as the frame. This will mean that for threads
 100   // that are parked on a mutex the profiler (and safepoint mechanism)
 101   // will see the thread as if it were still in the Java frame. This
 102   // not a problem for the profiler since the Java frame is a close


< prev index next >