268 PlatformMutex(); // Use freelist allocation of impl.
269 ~PlatformMutex();
270
271 static void init(); // Initialize the freelist.
272
273 #else
274
275 pthread_mutex_t _mutex;
276
277 protected:
278 pthread_mutex_t* mutex() { return &_mutex; }
279
280 public:
281 static void init() {} // Nothing needed for the non-indirect case.
282
283 PlatformMutex();
284 ~PlatformMutex();
285
286 #endif // PLATFORM_MONITOR_IMPL_INDIRECT
287
288 private:
289 // Disable copying
290 PlatformMutex(const PlatformMutex&);
291 PlatformMutex& operator=(const PlatformMutex&);
292
293 public:
294 void lock();
295 void unlock();
296 bool try_lock();
297 };
298
299 class PlatformMonitor : public PlatformMutex {
300 #if PLATFORM_MONITOR_IMPL_INDIRECT
301 class Cond : public CHeapObj<mtSynchronizer> {
302 public:
303 pthread_cond_t _cond;
304 Cond* _next;
305
306 Cond();
307 ~Cond();
308 };
309
310 Cond* _impl;
311
312 static Cond* _cond_freelist;
313
314 pthread_cond_t* cond() { return &(_impl->_cond); }
315
316 public:
317 PlatformMonitor(); // Use freelist allocation of impl.
318 ~PlatformMonitor();
319
320 #else
321
322 pthread_cond_t _cond;
323 pthread_cond_t* cond() { return &_cond; }
324
325 public:
326 PlatformMonitor();
327 ~PlatformMonitor();
328
329 #endif // PLATFORM_MONITOR_IMPL_INDIRECT
330
331 private:
332 // Disable copying
333 PlatformMonitor(const PlatformMonitor&);
334 PlatformMonitor& operator=(const PlatformMonitor&);
335
336 public:
337 int wait(jlong millis);
338 void notify();
339 void notify_all();
340 };
341
342 #endif // !SOLARIS
343
344 #endif // OS_POSIX_OS_POSIX_HPP
|
268 PlatformMutex(); // Use freelist allocation of impl.
269 ~PlatformMutex();
270
271 static void init(); // Initialize the freelist.
272
273 #else
274
275 pthread_mutex_t _mutex;
276
277 protected:
278 pthread_mutex_t* mutex() { return &_mutex; }
279
280 public:
281 static void init() {} // Nothing needed for the non-indirect case.
282
283 PlatformMutex();
284 ~PlatformMutex();
285
286 #endif // PLATFORM_MONITOR_IMPL_INDIRECT
287
288 private:
289 NONCOPYABLE(PlatformMutex);
290
291 public:
292 void lock();
293 void unlock();
294 bool try_lock();
295 };
296
297 class PlatformMonitor : public PlatformMutex {
298 #if PLATFORM_MONITOR_IMPL_INDIRECT
299 class Cond : public CHeapObj<mtSynchronizer> {
300 public:
301 pthread_cond_t _cond;
302 Cond* _next;
303
304 Cond();
305 ~Cond();
306 };
307
308 Cond* _impl;
309
310 static Cond* _cond_freelist;
311
312 pthread_cond_t* cond() { return &(_impl->_cond); }
313
314 public:
315 PlatformMonitor(); // Use freelist allocation of impl.
316 ~PlatformMonitor();
317
318 #else
319
320 pthread_cond_t _cond;
321 pthread_cond_t* cond() { return &_cond; }
322
323 public:
324 PlatformMonitor();
325 ~PlatformMonitor();
326
327 #endif // PLATFORM_MONITOR_IMPL_INDIRECT
328
329 private:
330 NONCOPYABLE(PlatformMonitor);
331
332 public:
333 int wait(jlong millis);
334 void notify();
335 void notify_all();
336 };
337
338 #endif // !SOLARIS
339
340 #endif // OS_POSIX_OS_POSIX_HPP
|