< prev index next >
src/share/vm/runtime/thread.hpp
Print this page
rev 9380 : 8237499: JFR: Include stack trace in the ThreadStart event
Reviewed-by: egahlin
@@ -329,10 +329,11 @@
virtual char* name() const { return (char*)"Unknown thread"; }
// Returns the current thread
static inline Thread* current();
+ static inline Thread* current_or_null();
// Common thread operations
static void set_priority(Thread* thread, ThreadPriority priority);
static ThreadPriority get_priority(const Thread* const thread);
static void start(Thread* thread);
@@ -681,10 +682,17 @@
Thread* thread = ThreadLocalStorage::thread();
assert(thread != NULL, "just checking");
return thread;
}
+inline Thread* Thread::current_or_null() {
+ if (ThreadLocalStorage::is_initialized()) {
+ return ThreadLocalStorage::thread();
+ }
+ return NULL;
+}
+
// Name support for threads. non-JavaThread subclasses with multiple
// uniquely named instances should derive from this.
class NamedThread: public Thread {
friend class VMStructs;
enum {
< prev index next >