207 |
207 |
208 // none present |
208 // none present |
209 |
209 |
210 // LinuxThreads work-around for 6292965 |
210 // LinuxThreads work-around for 6292965 |
211 static int safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime); |
211 static int safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime); |
212 |
|
213 |
|
214 // Linux suspend/resume support - this helper is a shadow of its former |
|
215 // self now that low-level suspension is barely used, and old workarounds |
|
216 // for LinuxThreads are no longer needed. |
|
217 class SuspendResume { |
|
218 private: |
|
219 volatile int _suspend_action; |
|
220 volatile jint _state; |
|
221 public: |
|
222 // values for suspend_action: |
|
223 enum { |
|
224 SR_NONE = 0x00, |
|
225 SR_SUSPEND = 0x01, // suspend request |
|
226 SR_CONTINUE = 0x02, // resume request |
|
227 SR_SUSPENDED = 0x20 // values for _state: + SR_NONE |
|
228 }; |
|
229 |
|
230 SuspendResume() { _suspend_action = SR_NONE; _state = SR_NONE; } |
|
231 |
|
232 int suspend_action() const { return _suspend_action; } |
|
233 void set_suspend_action(int x) { _suspend_action = x; } |
|
234 |
|
235 // atomic updates for _state |
|
236 inline void set_suspended(); |
|
237 inline void clear_suspended(); |
|
238 bool is_suspended() { return _state & SR_SUSPENDED; } |
|
239 |
|
240 }; |
|
241 |
212 |
242 private: |
213 private: |
243 typedef int (*sched_getcpu_func_t)(void); |
214 typedef int (*sched_getcpu_func_t)(void); |
244 typedef int (*numa_node_to_cpus_func_t)(int node, unsigned long *buffer, int bufferlen); |
215 typedef int (*numa_node_to_cpus_func_t)(int node, unsigned long *buffer, int bufferlen); |
245 typedef int (*numa_max_node_func_t)(void); |
216 typedef int (*numa_max_node_func_t)(void); |
331 status = pthread_cond_init (_cond, NULL); |
302 status = pthread_cond_init (_cond, NULL); |
332 assert_status(status == 0, status, "cond_init"); |
303 assert_status(status == 0, status, "cond_init"); |
333 status = pthread_mutex_init (_mutex, NULL); |
304 status = pthread_mutex_init (_mutex, NULL); |
334 assert_status(status == 0, status, "mutex_init"); |
305 assert_status(status == 0, status, "mutex_init"); |
335 } |
306 } |
336 } ; |
307 }; |
337 |
308 |
338 #endif // OS_LINUX_VM_OS_LINUX_HPP |
309 #endif // OS_LINUX_VM_OS_LINUX_HPP |