/usr/include/sigx-2.0/sigx/connection_wrapper.h is in libsigx-2.0-dev 2.0.2-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | #ifndef _SIGX_CONNECTION_HPP_
#define _SIGX_CONNECTION_HPP_
/*
* Copyright 2006 Klaus Triendl
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include <tr1/memory> // std::tr1::shared_ptr
#include <sigxconfig.h>
#include <sigx/fwddecl.h>
#include <sigx/shared_dispatchable.h>
namespace sigx
{
/** @short A threadsafe representation of a sigc::connection.
* @ingroup signals
*/
class SIGX_API connection_wrapper
{
private:
// volatile because the value should be always read from the variable itself;
// this is necessary because the sigc::connection* is "late bound", i.e.
// it is set by the server thread after an asynchronous "connect" message.
// When the next tunnel functor is created (let's say with disconnect())
// then m_sigc_conn is dereferenced (*m_sigc_conn) and the actual pointer
// value (the sigc::connection*) is treated volatile at the other side of
// the tunnel (at the server thread's side).
// It is const because the connection_wrapper object doesn't modify the pointer.
typedef std::tr1::shared_ptr<const volatile sigc_connection_ptr> shared_sigc_conn_ptr;
public:
/** @short Construct an empty connection_wrapper.
*/
connection_wrapper();
/** @short Construct from a dispatchable and a late bound pointer to the server thread's
* sigc::connection.
*/
connection_wrapper(const shared_dispatchable& _A_disp, const shared_sigc_conn_ptr& _A_conn);
/** @short Copy construct from another connection_wrapper
*/
connection_wrapper(const connection_wrapper& other) throw();
/**
* @note destroying is asynchronous
*/
~connection_wrapper() throw();
/** @note nonvolatile, may only be executed by a single thread.
*/
connection_wrapper& operator =(const connection_wrapper& other);
public:
/**
* @note synchronous
*/
bool empty() const;
/**
* @note synchronous
*/
bool connected() const;
/**
* @note synchronous
*/
bool blocked() const;
/**
* @note synchronous
*/
bool block(bool should_block = true);
/**
* @note synchronous
*/
bool unblock();
/**
* @note synchronous
*/
void disconnect();
/**
* @note non-const because sigc::connection::operator bool is non-const
* @note synchronous
*/
operator bool();
protected:
void destroy_self();
private:
/// the sigc::connection living in the context of the server thread
shared_sigc_conn_ptr m_sigc_conn;
/// the dispatchable over which we are sending the messages to the
/// server thread's sigc::connection
shared_dispatchable m_shared_disp;
/// how many times the sigc::connection is shared by multiple
/// connection_wrapper objects
volatile int* m_sigcconn_refcount;
};
} // namespace sigx
#endif // end file guard
|