< prev index next >

src/hotspot/os/posix/os_posix.inline.hpp

Print this page




  30 #ifdef SUPPORTS_CLOCK_MONOTONIC
  31 
  32 // Exported clock functionality
  33 
  34 inline bool os::Posix::supports_monotonic_clock() {
  35   return _clock_gettime != NULL;
  36 }
  37 
  38 inline int os::Posix::clock_gettime(clockid_t clock_id, struct timespec *tp) {
  39   return _clock_gettime != NULL ? _clock_gettime(clock_id, tp) : -1;
  40 }
  41 
  42 inline int os::Posix::clock_getres(clockid_t clock_id, struct timespec *tp) {
  43   return _clock_getres != NULL ? _clock_getres(clock_id, tp) : -1;
  44 }
  45 
  46 #endif // SUPPORTS_CLOCK_MONOTONIC
  47 
  48 #ifndef SOLARIS
  49 
  50 // Platform Mutex/Monitor implementation
  51 
  52 inline void os::PlatformMutex::lock() {
  53   int status = pthread_mutex_lock(mutex());
  54   assert_status(status == 0, status, "mutex_lock");
  55 }
  56 
  57 inline void os::PlatformMutex::unlock() {
  58   int status = pthread_mutex_unlock(mutex());
  59   assert_status(status == 0, status, "mutex_unlock");
  60 }
  61 
  62 inline bool os::PlatformMutex::try_lock() {
  63   int status = pthread_mutex_trylock(mutex());
  64   assert_status(status == 0 || status == EBUSY, status, "mutex_trylock");
  65   return status == 0;
  66 }
  67 
  68 inline void os::PlatformMonitor::notify() {
  69   int status = pthread_cond_signal(cond());
  70   assert_status(status == 0, status, "cond_signal");
  71 }
  72 
  73 inline void os::PlatformMonitor::notify_all() {
  74   int status = pthread_cond_broadcast(cond());
  75   assert_status(status == 0, status, "cond_broadcast");
  76 }
  77 
  78 #endif // !SOLARIS
  79 
  80 #endif // OS_POSIX_OS_POSIX_INLINE_HPP


  30 #ifdef SUPPORTS_CLOCK_MONOTONIC
  31 
  32 // Exported clock functionality
  33 
  34 inline bool os::Posix::supports_monotonic_clock() {
  35   return _clock_gettime != NULL;
  36 }
  37 
  38 inline int os::Posix::clock_gettime(clockid_t clock_id, struct timespec *tp) {
  39   return _clock_gettime != NULL ? _clock_gettime(clock_id, tp) : -1;
  40 }
  41 
  42 inline int os::Posix::clock_getres(clockid_t clock_id, struct timespec *tp) {
  43   return _clock_getres != NULL ? _clock_getres(clock_id, tp) : -1;
  44 }
  45 
  46 #endif // SUPPORTS_CLOCK_MONOTONIC
  47 
  48 #ifndef SOLARIS
  49 
  50 // Platform Monitor implementation
  51 
  52 inline void os::PlatformMonitor::lock() {
  53   int status = pthread_mutex_lock(mutex());
  54   assert_status(status == 0, status, "mutex_lock");
  55 }
  56 
  57 inline void os::PlatformMonitor::unlock() {
  58   int status = pthread_mutex_unlock(mutex());
  59   assert_status(status == 0, status, "mutex_unlock");
  60 }
  61 
  62 inline bool os::PlatformMonitor::try_lock() {
  63   int status = pthread_mutex_trylock(mutex());
  64   assert_status(status == 0 || status == EBUSY, status, "mutex_trylock");
  65   return status == 0;
  66 }
  67 
  68 inline void os::PlatformMonitor::notify() {
  69   int status = pthread_cond_signal(cond());
  70   assert_status(status == 0, status, "cond_signal");
  71 }
  72 
  73 inline void os::PlatformMonitor::notify_all() {
  74   int status = pthread_cond_broadcast(cond());
  75   assert_status(status == 0, status, "cond_broadcast");
  76 }
  77 
  78 #endif // !SOLARIS
  79 
  80 #endif // OS_POSIX_OS_POSIX_INLINE_HPP
< prev index next >