< prev index next >

src/share/vm/runtime/osThread.hpp

Print this page
rev 8802 : G1 performance improvements: card batching, joining, sorting, prefetching and write barrier fence elision and simplification based on a global syncrhonization using handshakes piggybacking on thread-local safepoints.


 108 #ifdef TARGET_OS_FAMILY_aix
 109 # include "osThread_aix.hpp"
 110 #endif
 111 #ifdef TARGET_OS_FAMILY_bsd
 112 # include "osThread_bsd.hpp"
 113 #endif
 114 
 115  public:
 116   static ByteSize thread_id_offset()              { return byte_offset_of(OSThread, _thread_id); }
 117   static size_t thread_id_size()                  { return sizeof(thread_id_t); }
 118 
 119   thread_id_t thread_id() const                   { return _thread_id; }
 120 
 121   void set_thread_id(thread_id_t id)              { _thread_id = id; }
 122 
 123  private:
 124   // _thread_id is kernel thread id (similar to LWP id on Solaris). Each
 125   // thread has a unique thread_id (BsdThreads or NPTL). It can be used
 126   // to access /proc.
 127   thread_id_t _thread_id;



 128 };
 129 
 130 
 131 // Utility class for use with condition variables:
 132 class OSThreadWaitState : public StackObj {
 133   OSThread*   _osthread;
 134   ThreadState _old_state;
 135  public:
 136   OSThreadWaitState(OSThread* osthread, bool is_object_wait) {
 137     _osthread  = osthread;
 138     _old_state = osthread->get_state();
 139     if (is_object_wait) {
 140       osthread->set_state(OBJECT_WAIT);
 141     } else {
 142       osthread->set_state(CONDVAR_WAIT);
 143     }
 144   }
 145   ~OSThreadWaitState() {
 146     _osthread->set_state(_old_state);
 147   }


 108 #ifdef TARGET_OS_FAMILY_aix
 109 # include "osThread_aix.hpp"
 110 #endif
 111 #ifdef TARGET_OS_FAMILY_bsd
 112 # include "osThread_bsd.hpp"
 113 #endif
 114 
 115  public:
 116   static ByteSize thread_id_offset()              { return byte_offset_of(OSThread, _thread_id); }
 117   static size_t thread_id_size()                  { return sizeof(thread_id_t); }
 118 
 119   thread_id_t thread_id() const                   { return _thread_id; }
 120 
 121   void set_thread_id(thread_id_t id)              { _thread_id = id; }
 122 
 123  private:
 124   // _thread_id is kernel thread id (similar to LWP id on Solaris). Each
 125   // thread has a unique thread_id (BsdThreads or NPTL). It can be used
 126   // to access /proc.
 127   thread_id_t _thread_id;
 128 
 129  public:
 130   bool is_online();
 131 };
 132 
 133 
 134 // Utility class for use with condition variables:
 135 class OSThreadWaitState : public StackObj {
 136   OSThread*   _osthread;
 137   ThreadState _old_state;
 138  public:
 139   OSThreadWaitState(OSThread* osthread, bool is_object_wait) {
 140     _osthread  = osthread;
 141     _old_state = osthread->get_state();
 142     if (is_object_wait) {
 143       osthread->set_state(OBJECT_WAIT);
 144     } else {
 145       osthread->set_state(CONDVAR_WAIT);
 146     }
 147   }
 148   ~OSThreadWaitState() {
 149     _osthread->set_state(_old_state);
 150   }
< prev index next >