40 } |
40 } |
41 |
41 |
42 inline int os::Posix::clock_getres(clockid_t clock_id, struct timespec *tp) { |
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; |
43 return _clock_getres != NULL ? _clock_getres(clock_id, tp) : -1; |
44 } |
44 } |
|
45 |
45 #endif // SUPPORTS_CLOCK_MONOTONIC |
46 #endif // SUPPORTS_CLOCK_MONOTONIC |
46 |
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 |
47 #endif // OS_POSIX_OS_POSIX_INLINE_HPP |
80 #endif // OS_POSIX_OS_POSIX_INLINE_HPP |