diff options
Diffstat (limited to 'src/Net/Signals')
-rw-r--r-- | src/Net/Signals/Signal0.h | 9 | ||||
-rw-r--r-- | src/Net/Signals/Signal1.h | 12 | ||||
-rw-r--r-- | src/Net/Signals/Signal2.h | 12 | ||||
-rw-r--r-- | src/Net/Signals/SignalBase.h | 10 |
4 files changed, 23 insertions, 20 deletions
diff --git a/src/Net/Signals/Signal0.h b/src/Net/Signals/Signal0.h index 32859ab..c468135 100644 --- a/src/Net/Signals/Signal0.h +++ b/src/Net/Signals/Signal0.h @@ -26,13 +26,12 @@ namespace Mad { namespace Net { namespace Signals { -template <typename R> -class Signal0 : public SignalBase<boost::signal0<R>, boost::function0<R> > { +class Signal0 : public SignalBase<boost::signal0<void>, boost::function0<void> > { public: - R emit() { - boost::lock_guard<boost::recursive_mutex> lock(SignalBase<boost::signal0<R>, boost::function0<R> >::mutex); + void emit() { + boost::lock_guard<boost::mutex> lock(mutex); - return SignalBase<boost::signal0<R>, boost::function0<R> >::signal(); + signal(); } }; diff --git a/src/Net/Signals/Signal1.h b/src/Net/Signals/Signal1.h index 78eaa47..b9649be 100644 --- a/src/Net/Signals/Signal1.h +++ b/src/Net/Signals/Signal1.h @@ -20,17 +20,19 @@ #ifndef MAD_NET_SIGNALS_SIGNAL1_H_ #define MAD_NET_SIGNALS_SIGNAL1_H_ +#include "SignalBase.h" + namespace Mad { namespace Net { namespace Signals { -template <typename R, typename T1> -class Signal1 : public SignalBase<boost::signal1<R, T1>, boost::function1<R, T1> > { +template <typename T1> +class Signal1 : public SignalBase<boost::signal1<void, T1>, boost::function1<void, T1> > { public: - R emit(T1 arg1) { - boost::lock_guard<boost::recursive_mutex> lock(SignalBase<boost::signal1<R, T1>, boost::function1<R, T1> >::mutex); + void emit(T1 arg1) { + boost::lock_guard<boost::mutex> lock(SignalBase<boost::signal1<void, T1>, boost::function1<void, T1> >::mutex); - return SignalBase<boost::signal1<R, T1>, boost::function1<R, T1> >::signal(arg1); + SignalBase<boost::signal1<void, T1>, boost::function1<void, T1> >::signal(arg1); } }; diff --git a/src/Net/Signals/Signal2.h b/src/Net/Signals/Signal2.h index afa528e..374a239 100644 --- a/src/Net/Signals/Signal2.h +++ b/src/Net/Signals/Signal2.h @@ -20,17 +20,19 @@ #ifndef MAD_NET_SIGNALS_SIGNAL2_H_ #define MAD_NET_SIGNALS_SIGNAL2_H_ +#include "SignalBase.h" + namespace Mad { namespace Net { namespace Signals { -template <typename R, typename T1, typename T2> -class Signal2 : public SignalBase<boost::signal2<R, T1, T2>, boost::function2<R, T1, T2> > { +template <typename T1, typename T2> +class Signal2 : public SignalBase<boost::signal2<void, T1, T2>, boost::function2<void, T1, T2> > { public: - R emit(T1 arg1, T2 arg2) { - boost::lock_guard<boost::recursive_mutex> lock(SignalBase<boost::signal2<R, T1, T2>, boost::function2<R, T1, T2> >::mutex); + void emit(T1 arg1, T2 arg2) { + boost::lock_guard<boost::mutex> lock(SignalBase<boost::signal2<void, T1, T2>, boost::function2<void, T1, T2> >::mutex); - return SignalBase<boost::signal2<R, T1, T2>, boost::function2<R, T1, T2> >::signal(arg1, arg2); + SignalBase<boost::signal2<void, T1, T2>, boost::function2<void, T1, T2> >::signal(arg1, arg2); } }; diff --git a/src/Net/Signals/SignalBase.h b/src/Net/Signals/SignalBase.h index fc5f2c6..9e2de62 100644 --- a/src/Net/Signals/SignalBase.h +++ b/src/Net/Signals/SignalBase.h @@ -25,7 +25,7 @@ #include <set> #include <boost/signals.hpp> #include <boost/thread/locks.hpp> -#include <boost/thread/recursive_mutex.hpp> +#include <boost/thread/mutex.hpp> namespace Mad { namespace Net { @@ -40,19 +40,19 @@ class SignalBase : private boost::noncopyable { typedef SignalType signal_type; std::set<boost::signals::connection> connections; - boost::recursive_mutex mutex; + boost::mutex mutex; signal_type signal; SignalBase() {} ~SignalBase() { // Wait for other threads - boost::lock_guard<boost::recursive_mutex> lock(mutex); + boost::lock_guard<boost::mutex> lock(mutex); } public: Connection connect(const slot_type &slot) { - boost::lock_guard<boost::recursive_mutex> lock(mutex); + boost::lock_guard<boost::mutex> lock(mutex); boost::signals::connection con(signal.connect(slot)); @@ -61,7 +61,7 @@ class SignalBase : private boost::noncopyable { } void disconnect(const Connection &connection) { - boost::lock_guard<boost::recursive_mutex> lock(mutex); + boost::lock_guard<boost::mutex> lock(mutex); std::set<boost::signals::connection>::iterator it = connections.find(connection.connection); |