< prev index next >

src/share/vm/utilities/ostream.cpp

Print this page




1041     _outer_xmlStream = NULL;
1042 
1043     if (file) {
1044       file->flush();
1045 
1046       // Can't delete or close the file because delete and fclose aren't
1047       // async-safe. We are about to die, so leave it to the kernel.
1048       // delete file;
1049     }
1050   }
1051 }
1052 
1053 intx defaultStream::hold(intx writer_id) {
1054   bool has_log = has_log_file();  // check before locking
1055   if (// impossible, but who knows?
1056       writer_id == NO_WRITER ||
1057 
1058       // bootstrap problem
1059       tty_lock == NULL ||
1060 
1061       // can't grab a lock or call Thread::current() if TLS isn't initialized
1062       ThreadLocalStorage::thread() == NULL ||
1063 
1064       // developer hook
1065       !SerializeVMOutput ||
1066 
1067       // VM already unhealthy
1068       is_error_reported() ||
1069 
1070       // safepoint == global lock (for VM only)
1071       (SafepointSynchronize::is_synchronizing() &&
1072        Thread::current()->is_VM_thread())
1073       ) {
1074     // do not attempt to lock unless we know the thread and the VM is healthy
1075     return NO_WRITER;
1076   }
1077   if (_writer == writer_id) {
1078     // already held, no need to re-grab the lock
1079     return NO_WRITER;
1080   }
1081   tty_lock->lock_without_safepoint_check();
1082   // got the lock




1041     _outer_xmlStream = NULL;
1042 
1043     if (file) {
1044       file->flush();
1045 
1046       // Can't delete or close the file because delete and fclose aren't
1047       // async-safe. We are about to die, so leave it to the kernel.
1048       // delete file;
1049     }
1050   }
1051 }
1052 
1053 intx defaultStream::hold(intx writer_id) {
1054   bool has_log = has_log_file();  // check before locking
1055   if (// impossible, but who knows?
1056       writer_id == NO_WRITER ||
1057 
1058       // bootstrap problem
1059       tty_lock == NULL ||
1060 
1061       // can't grab a lock if current Thread isn't set
1062       Thread::current() == NULL ||
1063 
1064       // developer hook
1065       !SerializeVMOutput ||
1066 
1067       // VM already unhealthy
1068       is_error_reported() ||
1069 
1070       // safepoint == global lock (for VM only)
1071       (SafepointSynchronize::is_synchronizing() &&
1072        Thread::current()->is_VM_thread())
1073       ) {
1074     // do not attempt to lock unless we know the thread and the VM is healthy
1075     return NO_WRITER;
1076   }
1077   if (_writer == writer_id) {
1078     // already held, no need to re-grab the lock
1079     return NO_WRITER;
1080   }
1081   tty_lock->lock_without_safepoint_check();
1082   // got the lock


< prev index next >