1 /*
   2  * Copyright (c) 2014, 2015, Dynatrace and/or its affiliates. All rights reserved.
   3  *
   4  * This file is part of the Lock Contention Tracing Subsystem for the HotSpot
   5  * Virtual Machine, which is developed at Christian Doppler Laboratory on
   6  * Monitoring and Evolution of Very-Large-Scale Software Systems. Please
   7  * contact us at <http://mevss.jku.at/> if you need additional information
   8  * or have any questions.
   9  *
  10  * This code is free software; you can redistribute it and/or modify it
  11  * under the terms of the GNU General Public License version 2 only, as
  12  * published by the Free Software Foundation.
  13  *
  14  * This code is distributed in the hope that it will be useful, but WITHOUT
  15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  16  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  17  * version 2 for more details (a copy is included in the LICENSE file that
  18  * accompanied this code).
  19  *
  20  * You should have received a copy of the GNU General Public License version
  21  * 2 along with this work. If not, see <http://www.gnu.org/licenses/>.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_EVTRACE_TRACEREADERTHREAD_HPP
  26 #define SHARE_VM_EVTRACE_TRACEREADERTHREAD_HPP
  27 
  28 #include "runtime/thread.hpp"
  29 
  30 class TraceReaderThread: public JavaThread {
  31 private:
  32   oop _object;
  33   volatile bool _is_polling_queue;
  34 
  35   TraceReaderThread(oop obj);
  36 
  37   static void trace_reader_thread_entry(JavaThread* thread, TRAPS);
  38 
  39 public:
  40   virtual ~TraceReaderThread();
  41 
  42   virtual bool is_TraceReader_thread() const { return true; }
  43 
  44   void oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf);
  45 
  46   static TraceReaderThread * start(Handle flushq, Handle freeq, TRAPS);
  47 
  48   bool is_polling_queue() { return _is_polling_queue; }
  49   void set_is_polling_queue(bool polling) {
  50     assert(_is_polling_queue != polling, "flip only");
  51     _is_polling_queue = polling;
  52   }
  53 
  54   void shutdown(TRAPS);
  55 };
  56 
  57 #endif /* SHARE_VM_EVTRACE_TRACEREADERTHREAD_HPP */