src/share/vm/utilities/ostream.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 7021531 Sdiff src/share/vm/utilities

src/share/vm/utilities/ostream.cpp

Print this page




 682       flush();
 683     }
 684   } else {
 685     update_position(s, len);
 686   }
 687 
 688   release(holder);
 689 }
 690 
 691 intx ttyLocker::hold_tty() {
 692   if (defaultStream::instance == NULL)  return defaultStream::NO_WRITER;
 693   intx thread_id = os::current_thread_id();
 694   return defaultStream::instance->hold(thread_id);
 695 }
 696 
 697 void ttyLocker::release_tty(intx holder) {
 698   if (holder == defaultStream::NO_WRITER)  return;
 699   defaultStream::instance->release(holder);
 700 }
 701 











 702 void ttyLocker::break_tty_lock_for_safepoint(intx holder) {
 703   if (defaultStream::instance != NULL &&
 704       defaultStream::instance->writer() == holder) {
 705     if (xtty != NULL) {
 706       xtty->print_cr("<!-- safepoint while printing -->");
 707     }
 708     defaultStream::instance->release(holder);
 709   }
 710   // (else there was no lock to break)
 711 }
 712 
 713 void ostream_init() {
 714   if (defaultStream::instance == NULL) {
 715     defaultStream::instance = new(ResourceObj::C_HEAP) defaultStream();
 716     tty = defaultStream::instance;
 717 
 718     // We want to ensure that time stamps in GC logs consider time 0
 719     // the time when the JVM is initialized, not the first time we ask
 720     // for a time stamp. So, here, we explicitly update the time stamp
 721     // of tty.




 682       flush();
 683     }
 684   } else {
 685     update_position(s, len);
 686   }
 687 
 688   release(holder);
 689 }
 690 
 691 intx ttyLocker::hold_tty() {
 692   if (defaultStream::instance == NULL)  return defaultStream::NO_WRITER;
 693   intx thread_id = os::current_thread_id();
 694   return defaultStream::instance->hold(thread_id);
 695 }
 696 
 697 void ttyLocker::release_tty(intx holder) {
 698   if (holder == defaultStream::NO_WRITER)  return;
 699   defaultStream::instance->release(holder);
 700 }
 701 
 702 bool ttyLocker::release_tty_if_locked() {
 703   intx thread_id = os::current_thread_id();
 704   if (defaultStream::instance->writer() == thread_id) {
 705     // release the lock and return true so callers know if was
 706     // previously held.
 707     release_tty(thread_id);
 708     return true;
 709   }
 710   return false;
 711 }
 712 
 713 void ttyLocker::break_tty_lock_for_safepoint(intx holder) {
 714   if (defaultStream::instance != NULL &&
 715       defaultStream::instance->writer() == holder) {
 716     if (xtty != NULL) {
 717       xtty->print_cr("<!-- safepoint while printing -->");
 718     }
 719     defaultStream::instance->release(holder);
 720   }
 721   // (else there was no lock to break)
 722 }
 723 
 724 void ostream_init() {
 725   if (defaultStream::instance == NULL) {
 726     defaultStream::instance = new(ResourceObj::C_HEAP) defaultStream();
 727     tty = defaultStream::instance;
 728 
 729     // We want to ensure that time stamps in GC logs consider time 0
 730     // the time when the JVM is initialized, not the first time we ask
 731     // for a time stamp. So, here, we explicitly update the time stamp
 732     // of tty.


src/share/vm/utilities/ostream.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File