src/share/vm/prims/jvm.cpp

Print this page




2458   }
2459 }
2460 
2461 
2462 int jio_printf(const char *fmt, ...) {
2463   int len;
2464   va_list args;
2465   va_start(args, fmt);
2466   len = jio_vfprintf(defaultStream::output_stream(), fmt, args);
2467   va_end(args);
2468   return len;
2469 }
2470 
2471 
2472 // HotSpot specific jio method
2473 void jio_print(const char* s) {
2474   // Try to make this function as atomic as possible.
2475   if (Arguments::vfprintf_hook() != NULL) {
2476     jio_fprintf(defaultStream::output_stream(), "%s", s);
2477   } else {
2478     ::write(defaultStream::output_fd(), s, (int)strlen(s));

2479   }
2480 }
2481 
2482 } // Extern C
2483 
2484 // java.lang.Thread //////////////////////////////////////////////////////////////////////////////
2485 
2486 // In most of the JVM Thread support functions we need to be sure to lock the Threads_lock
2487 // to prevent the target thread from exiting after we have a pointer to the C++ Thread or
2488 // OSThread objects.  The exception to this rule is when the target object is the thread
2489 // doing the operation, in which case we know that the thread won't exit until the
2490 // operation is done (all exits being voluntary).  There are a few cases where it is
2491 // rather silly to do operations on yourself, like resuming yourself or asking whether
2492 // you are alive.  While these can still happen, they are not subject to deadlocks if
2493 // the lock is held while the operation occurs (this is not the case for suspend, for
2494 // instance), and are very unlikely.  Because IsAlive needs to be fast and its
2495 // implementation is local to this file, we always lock Threads_lock for that one.
2496 
2497 static void thread_entry(JavaThread* thread, TRAPS) {
2498   HandleMark hm(THREAD);




2458   }
2459 }
2460 
2461 
2462 int jio_printf(const char *fmt, ...) {
2463   int len;
2464   va_list args;
2465   va_start(args, fmt);
2466   len = jio_vfprintf(defaultStream::output_stream(), fmt, args);
2467   va_end(args);
2468   return len;
2469 }
2470 
2471 
2472 // HotSpot specific jio method
2473 void jio_print(const char* s) {
2474   // Try to make this function as atomic as possible.
2475   if (Arguments::vfprintf_hook() != NULL) {
2476     jio_fprintf(defaultStream::output_stream(), "%s", s);
2477   } else {
2478     // Make an unused local variable to avoid warning from gcc 4.x compiler.
2479     size_t count = ::write(defaultStream::output_fd(), s, (int)strlen(s));
2480   }
2481 }
2482 
2483 } // Extern C
2484 
2485 // java.lang.Thread //////////////////////////////////////////////////////////////////////////////
2486 
2487 // In most of the JVM Thread support functions we need to be sure to lock the Threads_lock
2488 // to prevent the target thread from exiting after we have a pointer to the C++ Thread or
2489 // OSThread objects.  The exception to this rule is when the target object is the thread
2490 // doing the operation, in which case we know that the thread won't exit until the
2491 // operation is done (all exits being voluntary).  There are a few cases where it is
2492 // rather silly to do operations on yourself, like resuming yourself or asking whether
2493 // you are alive.  While these can still happen, they are not subject to deadlocks if
2494 // the lock is held while the operation occurs (this is not the case for suspend, for
2495 // instance), and are very unlikely.  Because IsAlive needs to be fast and its
2496 // implementation is local to this file, we always lock Threads_lock for that one.
2497 
2498 static void thread_entry(JavaThread* thread, TRAPS) {
2499   HandleMark hm(THREAD);