< prev index next >

src/hotspot/os/posix/os_posix.hpp

Print this page
rev 59103 : imported patch hotspot


 155  * or anything else where we are not in control if we suddenly jump out.
 156  */
 157 class ThreadCrashProtection : public StackObj {
 158 public:
 159   static bool is_crash_protected(Thread* thr) {
 160     return _crash_protection != NULL && _protected_thread == thr;
 161   }
 162 
 163   ThreadCrashProtection();
 164   bool call(os::CrashProtectionCallback& cb);
 165 
 166   static void check_crash_protection(int signal, Thread* thread);
 167 private:
 168   static Thread* _protected_thread;
 169   static ThreadCrashProtection* _crash_protection;
 170   static volatile intptr_t _crash_mux;
 171   void restore();
 172   sigjmp_buf _jmpbuf;
 173 };
 174 
 175 #ifndef SOLARIS
 176 
 177 /*
 178  * This is the platform-specific implementation underpinning
 179  * the ParkEvent class, which itself underpins Java-level monitor
 180  * operations. See park.hpp for details.
 181  * These event objects are type-stable and immortal - we never delete them.
 182  * Events are associated with a thread for the lifetime of the thread.
 183  */
 184 class PlatformEvent : public CHeapObj<mtSynchronizer> {
 185  private:
 186   double cachePad[4];        // Increase odds that _mutex is sole occupant of cache line
 187   volatile int _event;       // Event count/permit: -1, 0 or 1
 188   volatile int _nParked;     // Indicates if associated thread is blocked: 0 or 1
 189   pthread_mutex_t _mutex[1]; // Native mutex for locking
 190   pthread_cond_t  _cond[1];  // Native condition variable for blocking
 191   double postPad[2];
 192 
 193  protected:       // TODO-FIXME: make dtor private
 194   ~PlatformEvent() { guarantee(false, "invariant"); } // immortal so can't delete
 195 


 318 
 319 #else
 320 
 321   pthread_cond_t _cond;
 322   pthread_cond_t* cond() { return &_cond; }
 323 
 324  public:
 325   PlatformMonitor();
 326   ~PlatformMonitor();
 327 
 328 #endif // PLATFORM_MONITOR_IMPL_INDIRECT
 329 
 330  private:
 331   NONCOPYABLE(PlatformMonitor);
 332 
 333  public:
 334   int wait(jlong millis);
 335   void notify();
 336   void notify_all();
 337 };
 338 
 339 #endif // !SOLARIS
 340 
 341 #endif // OS_POSIX_OS_POSIX_HPP


 155  * or anything else where we are not in control if we suddenly jump out.
 156  */
 157 class ThreadCrashProtection : public StackObj {
 158 public:
 159   static bool is_crash_protected(Thread* thr) {
 160     return _crash_protection != NULL && _protected_thread == thr;
 161   }
 162 
 163   ThreadCrashProtection();
 164   bool call(os::CrashProtectionCallback& cb);
 165 
 166   static void check_crash_protection(int signal, Thread* thread);
 167 private:
 168   static Thread* _protected_thread;
 169   static ThreadCrashProtection* _crash_protection;
 170   static volatile intptr_t _crash_mux;
 171   void restore();
 172   sigjmp_buf _jmpbuf;
 173 };
 174 

 175 
 176 /*
 177  * This is the platform-specific implementation underpinning
 178  * the ParkEvent class, which itself underpins Java-level monitor
 179  * operations. See park.hpp for details.
 180  * These event objects are type-stable and immortal - we never delete them.
 181  * Events are associated with a thread for the lifetime of the thread.
 182  */
 183 class PlatformEvent : public CHeapObj<mtSynchronizer> {
 184  private:
 185   double cachePad[4];        // Increase odds that _mutex is sole occupant of cache line
 186   volatile int _event;       // Event count/permit: -1, 0 or 1
 187   volatile int _nParked;     // Indicates if associated thread is blocked: 0 or 1
 188   pthread_mutex_t _mutex[1]; // Native mutex for locking
 189   pthread_cond_t  _cond[1];  // Native condition variable for blocking
 190   double postPad[2];
 191 
 192  protected:       // TODO-FIXME: make dtor private
 193   ~PlatformEvent() { guarantee(false, "invariant"); } // immortal so can't delete
 194 


 317 
 318 #else
 319 
 320   pthread_cond_t _cond;
 321   pthread_cond_t* cond() { return &_cond; }
 322 
 323  public:
 324   PlatformMonitor();
 325   ~PlatformMonitor();
 326 
 327 #endif // PLATFORM_MONITOR_IMPL_INDIRECT
 328 
 329  private:
 330   NONCOPYABLE(PlatformMonitor);
 331 
 332  public:
 333   int wait(jlong millis);
 334   void notify();
 335   void notify_all();
 336 };


 337 
 338 #endif // OS_POSIX_OS_POSIX_HPP
< prev index next >