Fix gcc-4.x/C++98 builds (amend f87de76b9f
)
This resolves error: invalid use of 'unary *' on pointer to member error: 'volatile gint RCUManager<std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::shared_ptr<ARDOUR::Port>, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::shared_ptr<ARDOUR::Port> > > > >::active_reads' is protected
This commit is contained in:
parent
b1846a578d
commit
01cdaa49b4
@ -52,7 +52,7 @@ class /*LIBPBD_API*/ RCUManager
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RCUManager (T* new_rcu_value)
|
RCUManager (T* new_rcu_value)
|
||||||
: active_reads (0)
|
: _active_reads (0)
|
||||||
{
|
{
|
||||||
x.rcu_value = new boost::shared_ptr<T> (new_rcu_value);
|
x.rcu_value = new boost::shared_ptr<T> (new_rcu_value);
|
||||||
}
|
}
|
||||||
@ -70,9 +70,9 @@ public:
|
|||||||
* wait until rcu_value is no longer in use after an atomic exchange
|
* wait until rcu_value is no longer in use after an atomic exchange
|
||||||
* before dropping it.
|
* before dropping it.
|
||||||
*/
|
*/
|
||||||
g_atomic_int_inc (&active_reads);
|
g_atomic_int_inc (&_active_reads);
|
||||||
rv = *((boost::shared_ptr<T>*)g_atomic_pointer_get (&x.gptr));
|
rv = *((boost::shared_ptr<T>*)g_atomic_pointer_get (&x.gptr));
|
||||||
g_atomic_int_dec_and_test (&active_reads);
|
g_atomic_int_dec_and_test (&_active_reads);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -100,7 +100,12 @@ protected:
|
|||||||
mutable volatile gpointer gptr;
|
mutable volatile gpointer gptr;
|
||||||
} x;
|
} x;
|
||||||
|
|
||||||
mutable volatile gint active_reads;
|
inline bool active_read () const {
|
||||||
|
return g_atomic_int_get (&_active_reads) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
mutable volatile gint _active_reads;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Serialized RCUManager implements the RCUManager interface. It is based on the
|
/** Serialized RCUManager implements the RCUManager interface. It is based on the
|
||||||
@ -196,7 +201,7 @@ public:
|
|||||||
* shared_ptr, and thus have had their reference count incremented.
|
* shared_ptr, and thus have had their reference count incremented.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (unsigned i = 0; g_atomic_int_get (&(RCUManager<T>::active_reads)) != 0; ++i) {
|
for (unsigned i = 0; RCUManager<T>::active_read (); ++i) {
|
||||||
// spin being nice to the scheduler/CPU
|
// spin being nice to the scheduler/CPU
|
||||||
boost::detail::yield (i);
|
boost::detail::yield (i);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user