hotspot/src/os/bsd/vm/os_bsd.hpp
changeset 25069 c937c5e883c5
parent 24239 db81abb281bc
child 25472 381638db28e6
equal deleted inserted replaced
25068:de4b1c96dca3 25069:c937c5e883c5
   189 };
   189 };
   190 
   190 
   191 
   191 
   192 class PlatformEvent : public CHeapObj<mtInternal> {
   192 class PlatformEvent : public CHeapObj<mtInternal> {
   193   private:
   193   private:
   194     double CachePad [4] ;   // increase odds that _mutex is sole occupant of cache line
   194     double CachePad[4];   // increase odds that _mutex is sole occupant of cache line
   195     volatile int _Event ;
   195     volatile int _Event;
   196     volatile int _nParked ;
   196     volatile int _nParked;
   197     pthread_mutex_t _mutex  [1] ;
   197     pthread_mutex_t _mutex[1];
   198     pthread_cond_t  _cond   [1] ;
   198     pthread_cond_t  _cond[1];
   199     double PostPad  [2] ;
   199     double PostPad[2];
   200     Thread * _Assoc ;
   200     Thread * _Assoc;
   201 
   201 
   202   public:       // TODO-FIXME: make dtor private
   202   public:       // TODO-FIXME: make dtor private
   203     ~PlatformEvent() { guarantee (0, "invariant") ; }
   203     ~PlatformEvent() { guarantee(0, "invariant"); }
   204 
   204 
   205   public:
   205   public:
   206     PlatformEvent() {
   206     PlatformEvent() {
   207       int status;
   207       int status;
   208       status = pthread_cond_init (_cond, NULL);
   208       status = pthread_cond_init (_cond, NULL);
   209       assert_status(status == 0, status, "cond_init");
   209       assert_status(status == 0, status, "cond_init");
   210       status = pthread_mutex_init (_mutex, NULL);
   210       status = pthread_mutex_init (_mutex, NULL);
   211       assert_status(status == 0, status, "mutex_init");
   211       assert_status(status == 0, status, "mutex_init");
   212       _Event   = 0 ;
   212       _Event   = 0;
   213       _nParked = 0 ;
   213       _nParked = 0;
   214       _Assoc   = NULL ;
   214       _Assoc   = NULL;
   215     }
   215     }
   216 
   216 
   217     // Use caution with reset() and fired() -- they may require MEMBARs
   217     // Use caution with reset() and fired() -- they may require MEMBARs
   218     void reset() { _Event = 0 ; }
   218     void reset() { _Event = 0; }
   219     int  fired() { return _Event; }
   219     int  fired() { return _Event; }
   220     void park () ;
   220     void park();
   221     void unpark () ;
   221     void unpark();
   222     int  TryPark () ;
   222     int  TryPark();
   223     int  park (jlong millis) ;
   223     int  park(jlong millis);
   224     void SetAssociation (Thread * a) { _Assoc = a ; }
   224     void SetAssociation(Thread * a) { _Assoc = a; }
   225 };
   225 };
   226 
   226 
   227 class PlatformParker : public CHeapObj<mtInternal> {
   227 class PlatformParker : public CHeapObj<mtInternal> {
   228   protected:
   228   protected:
   229     pthread_mutex_t _mutex [1] ;
   229     pthread_mutex_t _mutex[1];
   230     pthread_cond_t  _cond  [1] ;
   230     pthread_cond_t  _cond[1];
   231 
   231 
   232   public:       // TODO-FIXME: make dtor private
   232   public:       // TODO-FIXME: make dtor private
   233     ~PlatformParker() { guarantee (0, "invariant") ; }
   233     ~PlatformParker() { guarantee(0, "invariant"); }
   234 
   234 
   235   public:
   235   public:
   236     PlatformParker() {
   236     PlatformParker() {
   237       int status;
   237       int status;
   238       status = pthread_cond_init (_cond, NULL);
   238       status = pthread_cond_init (_cond, NULL);