xscheduler.h
1 /***************************************************************************
2  Copyright (C) 2002-2015 Kentaro Kitagawa
3  kitagawa@phys.s.u-tokyo.ac.jp
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  You should have received a copy of the GNU Library General
11  Public License and a list of authors along with this program;
12  see the files COPYING and AUTHORS.
13 ***************************************************************************/
14 #ifndef XSCHEDULER_H_
15 #define XSCHEDULER_H_
16 #include "xsignal.h"
17 #include "atomic_queue.h"
18 
19 //! Synchronize requests in talkers with main-thread
20 //! \sa Talker, XListener
22 public:
23  XSignalBuffer();
24  ~XSignalBuffer();
25  //! Called by Talker
27  //! be called by thread pool
28  bool synchronize(); //!< \return true if not busy
29 private:
31  typedef std::deque<std::pair<XTransaction_*, XTime> > SkippedQueue;
32  XTransaction_ *popOldest();
33  Queue m_queue;
34  SkippedQueue m_skippedQueue;
35  atomic<XTime> m_oldest_timestamp;
36 };
37 
38 extern atomic<unsigned int> g_adaptiveDelay; //!< ms.
39 extern shared_ptr<XSignalBuffer> g_signalBuffer;
40 
41 #endif /*XSCHEDULER_H_*/

Generated for KAME4 by  doxygen 1.8.3