VR-Forces 4.2 Class Documentation
callbackQueue.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include "vrfutil/vrfutilDefines.h"
13 
14 #include <boost/function.hpp>
15 #include <boost/shared_ptr.hpp>
16 
17 #include <tbb/mutex.h>
18 #include <tbb/tbb_thread.h>
19 #include <tbb/compat/condition_variable>
20 
21 #include <list>
22 
25 {
26 public:
27  typedef boost::function<void ()> Callback;
28 
31  explicit DtCallbackQueue(unsigned maxTasks);
32  ~DtCallbackQueue();
33 
35  void add(Callback);
36 
39  bool pop(Callback&);
40 
43  bool runOne();
44 
45 private:
46  void execute();
47 
48  typedef tbb::mutex Mutex;
49  typedef tbb::interface5::condition_variable Condition;
50  typedef tbb::interface5::unique_lock<Mutex> Lock;
51  typedef std::list< boost::shared_ptr<tbb::tbb_thread> > ThreadList;
52  typedef std::list<Callback> CallbackList;
53 
54  mutable Mutex myMutex;
59 };

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)