equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
665 public: |
665 public: |
666 NamedThread(); |
666 NamedThread(); |
667 ~NamedThread(); |
667 ~NamedThread(); |
668 // May only be called once per thread. |
668 // May only be called once per thread. |
669 void set_name(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); |
669 void set_name(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); |
|
670 void initialize_named_thread(); |
670 virtual bool is_Named_thread() const { return true; } |
671 virtual bool is_Named_thread() const { return true; } |
671 virtual char* name() const { return _name == NULL ? (char*)"Unknown Thread" : _name; } |
672 virtual char* name() const { return _name == NULL ? (char*)"Unknown Thread" : _name; } |
672 JavaThread *processed_thread() { return _processed_thread; } |
673 JavaThread *processed_thread() { return _processed_thread; } |
673 void set_processed_thread(JavaThread *thread) { _processed_thread = thread; } |
674 void set_processed_thread(JavaThread *thread) { _processed_thread = thread; } |
674 virtual void print_on(outputStream* st) const; |
675 virtual void print_on(outputStream* st) const; |
699 |
700 |
700 private: |
701 private: |
701 static WatcherThread* _watcher_thread; |
702 static WatcherThread* _watcher_thread; |
702 |
703 |
703 static bool _startable; |
704 static bool _startable; |
704 volatile static bool _should_terminate; // updated without holding lock |
705 // volatile due to at least one lock-free read |
|
706 volatile static bool _should_terminate; |
705 |
707 |
706 os::WatcherThreadCrashProtection* _crash_protection; |
708 os::WatcherThreadCrashProtection* _crash_protection; |
707 public: |
709 public: |
708 enum SomeConstants { |
710 enum SomeConstants { |
709 delay_interval = 10 // interrupt delay in milliseconds |
711 delay_interval = 10 // interrupt delay in milliseconds |