/usr/include/sigx-2.0/sigx/shared_dispatchable.h is in libsigx-2.0-dev 2.0.2-3.
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 | #ifndef _SIGX_SHARED_DISPATCHABLE_HPP_
#define _SIGX_SHARED_DISPATCHABLE_HPP_
/*
* Copyright 2008 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 <sigc++/reference_wrapper.h>
#include <sigxconfig.h>
#include <sigx/fwddecl.h>
#include <sigx/dispatchable.h>
namespace sigx
{
/** @short thread safe dispatcher reference that can be passed around.
*
* A shared dispatchable holds either a copy of another dispatchable
* or
* the dispatcher itself is only accessible by constructing a
* shared_dispatchable::DispatcherPtr.
*
* @note Multiple reads of the same object are threadsafe, multiple writes not:
* @code
* // threadsafe
* shared_dispatchable::DispatcherPtr dispatcher(shareddisp);
*
* // not threadsafe
* shareddisp = mydisp;
* @endcode
*
* @ingroup Dispatching
*/
class SIGX_API shared_dispatchable: public dispatchable
{
friend struct DispatcherPtr;
// must get the dispatcher ptr over dispatcher() for assertions
friend class tunnel_validity_tracker;
public:
///** @short behaves like a dispatcher pointer, ensures threadsafe access to the dispatcher reference.
// *
// * A DispatcherPtr is constructed from a dispatchable and references the
// * dispatcher of the dispatchable. A read lock ensures threadsafe access to
// * the reference (the owner thread sets a read/write lock when it sets
// * the reference to 0).
// * After you have constructed a DispatcherPtr, you *must* test for null.
// */
//class DispatcherPtr
//{
//public:
// explicit DispatcherPtr(shared_dispatchable& _A_disp):
// m_locker(*_A_disp.m_disp_ptr)
// {}
//
// /** @short Returns a plain dispatcher*
// */
// dispatcher_ptr operator ->()
// { return access_acquiree(m_locker); }
// operator bool()
// { return access_acquiree(m_locker); }
// bool operator !()
// { return !access_acquiree(m_locker); }
// bool operator !=(dispatcher_ptr other)
// { return other != access_acquiree(m_locker); }
//
//private:
// readlock_acquirer<internal::rwlockable_dispatcher_ptr> m_locker;
//};
class DispatcherPtr;
public:
/**
* @throw Might throw a std::bad_alloc exception (from dispatchable's ctor)
*/
shared_dispatchable();
/** @short Copy construct from any dispatchable.
*/
shared_dispatchable(const dispatchable& d) throw();
/** @short Assign from any dispatchable.
*/
shared_dispatchable& operator =(const dispatchable& d) throw();
};
} // namespace sigx
#endif // end file guard
|