poll_manager.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009, Willow Garage, Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  * * Redistributions of source code must retain the above copyright notice,
7  * this list of conditions and the following disclaimer.
8  * * Redistributions in binary form must reproduce the above copyright
9  * notice, this list of conditions and the following disclaimer in the
10  * documentation and/or other materials provided with the distribution.
11  * * Neither the names of Willow Garage, Inc. nor the names of its
12  * contributors may be used to endorse or promote products derived from
13  * this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  * POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef ROSCPP_POLL_MANAGER_H
29 #define ROSCPP_POLL_MANAGER_H
30 
31 #include "forwards.h"
32 #include "poll_set.h"
33 #include "common.h"
34 
35 #include <boost/signals2.hpp>
36 
37 #include <boost/thread/recursive_mutex.hpp>
38 #include <boost/thread/thread.hpp>
39 
40 namespace ros
41 {
42 
43 class PollManager;
45 typedef boost::signals2::signal<void(void)> VoidSignal;
46 typedef boost::function<void(void)> VoidFunc;
47 
48 class ROSCPP_DECL PollManager
49 {
50 public:
51  static const PollManagerPtr& instance();
52 
53  PollManager();
54  ~PollManager();
55 
56  PollSet& getPollSet() { return poll_set_; }
57 
58  boost::signals2::connection addPollThreadListener(const VoidFunc& func);
59  void removePollThreadListener(boost::signals2::connection c);
60 
61  void start();
62  void shutdown();
63 private:
64  void threadFunc();
65 
67  volatile bool shutting_down_;
68 
69  VoidSignal poll_signal_;
70  boost::recursive_mutex signal_mutex_;
71 
72  boost::thread thread_;
73 };
74 
75 }
76 
77 #endif
boost::recursive_mutex signal_mutex_
Definition: poll_manager.h:70
ROSCPP_DECL void start()
Actually starts the internals of the node (spins up threads, starts the network polling and xmlrpc lo...
Definition: init.cpp:293
boost::function< void(void)> VoidFunc
Definition: poll_manager.h:46
Manages a set of sockets being polled through the poll() function call.
Definition: poll_set.h:57
PollSet & getPollSet()
Definition: poll_manager.h:56
void threadFunc(boost::barrier *b)
ROSCPP_DECL void shutdown()
Disconnects everything and unregisters from the master. It is generally not necessary to call this fu...
Definition: init.cpp:578
boost::thread thread_
Definition: poll_manager.h:72
volatile bool shutting_down_
Definition: poll_manager.h:67
VoidSignal poll_signal_
Definition: poll_manager.h:69
boost::signals2::signal< void(void)> VoidSignal
Definition: poll_manager.h:45
boost::shared_ptr< PollManager > PollManagerPtr


roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim
autogenerated on Sun Feb 3 2019 03:29:54