comparison src/os/bsd/vm/os_bsd.hpp @ 10405:f2110083203d

8005849: JEP 167: Event-Based JVM Tracing Reviewed-by: acorn, coleenp, sla Contributed-by: Karen Kinnear <karen.kinnear@oracle.com>, Bengt Rutisson <bengt.rutisson@oracle.com>, Calvin Cheung <calvin.cheung@oracle.com>, Erik Gahlin <erik.gahlin@oracle.com>, Erik Helin <erik.helin@oracle.com>, Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com>, Keith McGuigan <keith.mcguigan@oracle.com>, Mattias Tobiasson <mattias.tobiasson@oracle.com>, Markus Gronlund <markus.gronlund@oracle.com>, Mikael Auno <mikael.auno@oracle.com>, Nils Eliasson <nils.eliasson@oracle.com>, Nils Loodin <nils.loodin@oracle.com>, Rickard Backman <rickard.backman@oracle.com>, Staffan Larsen <staffan.larsen@oracle.com>, Stefan Karlsson <stefan.karlsson@oracle.com>, Yekaterina Kantserova <yekaterina.kantserova@oracle.com>
author sla
date Mon, 10 Jun 2013 11:30:51 +0200
parents 63e54c37ac64
children faff125a1ead
comparison
equal deleted inserted replaced
10404:d0add7016434 10405:f2110083203d
142 142
143 // none present 143 // none present
144 144
145 // BsdThreads work-around for 6292965 145 // BsdThreads work-around for 6292965
146 static int safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime); 146 static int safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime);
147
148
149 // Bsd suspend/resume support - this helper is a shadow of its former
150 // self now that low-level suspension is barely used, and old workarounds
151 // for BsdThreads are no longer needed.
152 class SuspendResume {
153 private:
154 volatile int _suspend_action;
155 volatile jint _state;
156 public:
157 // values for suspend_action:
158 enum {
159 SR_NONE = 0x00,
160 SR_SUSPEND = 0x01, // suspend request
161 SR_CONTINUE = 0x02, // resume request
162 SR_SUSPENDED = 0x20 // values for _state: + SR_NONE
163 };
164
165 SuspendResume() { _suspend_action = SR_NONE; _state = SR_NONE; }
166
167 int suspend_action() const { return _suspend_action; }
168 void set_suspend_action(int x) { _suspend_action = x; }
169
170 // atomic updates for _state
171 inline void set_suspended();
172 inline void clear_suspended();
173 bool is_suspended() { return _state & SR_SUSPENDED; }
174
175 #undef SR_SUSPENDED
176 };
177 147
178 private: 148 private:
179 typedef int (*sched_getcpu_func_t)(void); 149 typedef int (*sched_getcpu_func_t)(void);
180 typedef int (*numa_node_to_cpus_func_t)(int node, unsigned long *buffer, int bufferlen); 150 typedef int (*numa_node_to_cpus_func_t)(int node, unsigned long *buffer, int bufferlen);
181 typedef int (*numa_max_node_func_t)(void); 151 typedef int (*numa_max_node_func_t)(void);
248 void park () ; 218 void park () ;
249 void unpark () ; 219 void unpark () ;
250 int TryPark () ; 220 int TryPark () ;
251 int park (jlong millis) ; 221 int park (jlong millis) ;
252 void SetAssociation (Thread * a) { _Assoc = a ; } 222 void SetAssociation (Thread * a) { _Assoc = a ; }
253 } ; 223 };
254 224
255 class PlatformParker : public CHeapObj<mtInternal> { 225 class PlatformParker : public CHeapObj<mtInternal> {
256 protected: 226 protected:
257 pthread_mutex_t _mutex [1] ; 227 pthread_mutex_t _mutex [1] ;
258 pthread_cond_t _cond [1] ; 228 pthread_cond_t _cond [1] ;
266 status = pthread_cond_init (_cond, NULL); 236 status = pthread_cond_init (_cond, NULL);
267 assert_status(status == 0, status, "cond_init"); 237 assert_status(status == 0, status, "cond_init");
268 status = pthread_mutex_init (_mutex, NULL); 238 status = pthread_mutex_init (_mutex, NULL);
269 assert_status(status == 0, status, "mutex_init"); 239 assert_status(status == 0, status, "mutex_init");
270 } 240 }
271 } ; 241 };
272 242
273 #endif // OS_BSD_VM_OS_BSD_HPP 243 #endif // OS_BSD_VM_OS_BSD_HPP