[openrtm-commit:00098] r2127 - branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm
openrtm @ openrtm.org
openrtm @ openrtm.org
2011年 5月 24日 (火) 12:46:35 JST
Author: n-ando
Date: 2011-05-24 12:46:35 +0900 (Tue, 24 May 2011)
New Revision: 2127
Modified:
branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ComponentActionListener.cpp
branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ComponentActionListener.h
branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ConfigurationListener.cpp
branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ConfigurationListener.h
branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ConnectorListener.cpp
branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ConnectorListener.h
branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/PortConnectListener.cpp
branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/PortConnectListener.h
Log:
ListenersHolder's listener list are now guarded by mutex. refs #2137
Modified: branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ComponentActionListener.cpp
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ComponentActionListener.cpp 2011-05-23 19:57:18 UTC (rev 2126)
+++ branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ComponentActionListener.cpp 2011-05-24 03:46:35 UTC (rev 2127)
@@ -77,6 +77,7 @@
PreComponentActionListenerHolder::~PreComponentActionListenerHolder()
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
if (m_listeners[i].second)
@@ -87,15 +88,19 @@
}
- void PreComponentActionListenerHolder::addListener(PreComponentActionListener* listener,
- bool autoclean)
+ void PreComponentActionListenerHolder::
+ addListener(PreComponentActionListener* listener,
+ bool autoclean)
{
+ Guard guard(m_mutex);
m_listeners.push_back(Entry(listener, autoclean));
}
- void PreComponentActionListenerHolder::removeListener(PreComponentActionListener* listener)
+ void PreComponentActionListenerHolder::
+ removeListener(PreComponentActionListener* listener)
{
+ Guard guard(m_mutex);
std::vector<Entry>::iterator it(m_listeners.begin());
for (; it != m_listeners.end(); ++it)
@@ -116,6 +121,7 @@
void PreComponentActionListenerHolder::notify(UniqueId ec_id)
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
m_listeners[i].first->operator()(ec_id);
@@ -137,6 +143,7 @@
PostComponentActionListenerHolder::~PostComponentActionListenerHolder()
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
if (m_listeners[i].second)
@@ -150,6 +157,7 @@
void PostComponentActionListenerHolder::
addListener(PostComponentActionListener* listener, bool autoclean)
{
+ Guard guard(m_mutex);
m_listeners.push_back(Entry(listener, autoclean));
}
@@ -157,6 +165,7 @@
void PostComponentActionListenerHolder::
removeListener(PostComponentActionListener* listener)
{
+ Guard guard(m_mutex);
std::vector<Entry>::iterator it(m_listeners.begin());
for (; it != m_listeners.end(); ++it)
{
@@ -177,6 +186,7 @@
void PostComponentActionListenerHolder::notify(UniqueId ec_id,
ReturnCode_t ret)
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
m_listeners[i].first->operator()(ec_id, ret);
@@ -198,6 +208,7 @@
PortActionListenerHolder::~PortActionListenerHolder()
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
if (m_listeners[i].second)
@@ -211,12 +222,14 @@
void PortActionListenerHolder::addListener(PortActionListener* listener,
bool autoclean)
{
+ Guard guard(m_mutex);
m_listeners.push_back(Entry(listener, autoclean));
}
void PortActionListenerHolder::removeListener(PortActionListener* listener)
{
+ Guard guard(m_mutex);
std::vector<Entry>::iterator it(m_listeners.begin());
for (; it != m_listeners.end(); ++it)
@@ -237,6 +250,7 @@
void PortActionListenerHolder::notify(const RTC::PortProfile& pprofile)
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
m_listeners[i].first->operator()(pprofile);
@@ -259,6 +273,7 @@
ExecutionContextActionListenerHolder::~ExecutionContextActionListenerHolder()
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
if (m_listeners[i].second)
@@ -269,15 +284,19 @@
}
- void ExecutionContextActionListenerHolder::addListener(ExecutionContextActionListener* listener,
- bool autoclean)
+ void ExecutionContextActionListenerHolder::
+ addListener(ExecutionContextActionListener* listener,
+ bool autoclean)
{
+ Guard guard(m_mutex);
m_listeners.push_back(Entry(listener, autoclean));
}
- void ExecutionContextActionListenerHolder::removeListener(ExecutionContextActionListener* listener)
+ void ExecutionContextActionListenerHolder::
+ removeListener(ExecutionContextActionListener* listener)
{
+ Guard guard(m_mutex);
std::vector<Entry>::iterator it(m_listeners.begin());
for (; it != m_listeners.end(); ++it)
@@ -298,6 +317,7 @@
void ExecutionContextActionListenerHolder::notify(UniqueId ec_id)
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
m_listeners[i].first->operator()(ec_id);
Modified: branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ComponentActionListener.h
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ComponentActionListener.h 2011-05-23 19:57:18 UTC (rev 2126)
+++ branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ComponentActionListener.h 2011-05-24 03:46:35 UTC (rev 2127)
@@ -21,6 +21,8 @@
#include <vector>
#include <utility>
+#include <coil/Mutex.h>
+#include <coil/Guard.h>
#include <rtm/RTC.h>
#include <rtm/idl/RTCSkel.h>
#include <rtm/ConnectorBase.h>
@@ -592,6 +594,7 @@
class PreComponentActionListenerHolder
{
typedef std::pair<PreComponentActionListener*, bool> Entry;
+ typedef coil::Guard<coil::Mutex> Guard;
public:
/*!
* @if jp
@@ -674,6 +677,7 @@
private:
std::vector<Entry> m_listeners;
+ coil::Mutex m_mutex;
};
@@ -696,6 +700,7 @@
class PostComponentActionListenerHolder
{
typedef std::pair<PostComponentActionListener*, bool> Entry;
+ typedef coil::Guard<coil::Mutex> Guard;
public:
/*!
* @if jp
@@ -779,6 +784,7 @@
private:
std::vector<Entry> m_listeners;
+ coil::Mutex m_mutex;
};
@@ -802,6 +808,7 @@
class PortActionListenerHolder
{
typedef std::pair<PortActionListener*, bool> Entry;
+ typedef coil::Guard<coil::Mutex> Guard;
public:
/*!
* @if jp
@@ -885,6 +892,7 @@
private:
std::vector<Entry> m_listeners;
+ coil::Mutex m_mutex;
};
/*!
@@ -906,6 +914,7 @@
class ExecutionContextActionListenerHolder
{
typedef std::pair<ExecutionContextActionListener*, bool> Entry;
+ typedef coil::Guard<coil::Mutex> Guard;
public:
/*!
* @if jp
@@ -989,6 +998,7 @@
private:
std::vector<Entry> m_listeners;
+ coil::Mutex m_mutex;
};
Modified: branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ConfigurationListener.cpp
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ConfigurationListener.cpp 2011-05-23 19:57:18 UTC (rev 2126)
+++ branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ConfigurationListener.cpp 2011-05-24 03:46:35 UTC (rev 2127)
@@ -65,6 +65,7 @@
ConfigurationParamListenerHolder::~ConfigurationParamListenerHolder()
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
if (m_listeners[i].second)
@@ -79,6 +80,7 @@
addListener(ConfigurationParamListener* listener,
bool autoclean)
{
+ Guard guard(m_mutex);
m_listeners.push_back(Entry(listener, autoclean));
}
@@ -86,6 +88,7 @@
void ConfigurationParamListenerHolder::
removeListener(ConfigurationParamListener* listener)
{
+ Guard guard(m_mutex);
std::vector<Entry>::iterator it(m_listeners.begin());
for (; it != m_listeners.end(); ++it)
@@ -107,6 +110,7 @@
void ConfigurationParamListenerHolder::notify(const char* config_set_name,
const char* config_param_name)
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
m_listeners[i].first->operator()(config_set_name, config_param_name);
@@ -129,6 +133,7 @@
ConfigurationSetListenerHolder::~ConfigurationSetListenerHolder()
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
if (m_listeners[i].second)
@@ -143,6 +148,7 @@
addListener(ConfigurationSetListener* listener,
bool autoclean)
{
+ Guard guard(m_mutex);
m_listeners.push_back(Entry(listener, autoclean));
}
@@ -150,6 +156,7 @@
void ConfigurationSetListenerHolder::
removeListener(ConfigurationSetListener* listener)
{
+ Guard guard(m_mutex);
std::vector<Entry>::iterator it(m_listeners.begin());
for (; it != m_listeners.end(); ++it)
@@ -171,6 +178,7 @@
void ConfigurationSetListenerHolder::
notify(const coil::Properties& config_set)
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
m_listeners[i].first->operator()(config_set);
@@ -192,6 +200,7 @@
ConfigurationSetNameListenerHolder::~ConfigurationSetNameListenerHolder()
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
if (m_listeners[i].second)
@@ -205,6 +214,7 @@
void ConfigurationSetNameListenerHolder::
addListener(ConfigurationSetNameListener* listener, bool autoclean)
{
+ Guard guard(m_mutex);
m_listeners.push_back(Entry(listener, autoclean));
}
@@ -212,6 +222,7 @@
void ConfigurationSetNameListenerHolder::
removeListener(ConfigurationSetNameListener* listener)
{
+ Guard guard(m_mutex);
std::vector<Entry>::iterator it(m_listeners.begin());
for (; it != m_listeners.end(); ++it)
{
@@ -231,6 +242,7 @@
void ConfigurationSetNameListenerHolder::notify(const char* config_set_name)
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
m_listeners[i].first->operator()(config_set_name);
Modified: branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ConfigurationListener.h
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ConfigurationListener.h 2011-05-23 19:57:18 UTC (rev 2126)
+++ branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ConfigurationListener.h 2011-05-24 03:46:35 UTC (rev 2127)
@@ -21,6 +21,8 @@
#include <vector>
#include <coil/Properties.h>
+#include <coil/Mutex.h>
+#include <coil/Guard.h>
namespace RTC
{
@@ -380,6 +382,7 @@
class ConfigurationParamListenerHolder
{
typedef std::pair<ConfigurationParamListener*, bool> Entry;
+ typedef coil::Guard<coil::Mutex> Guard;
public:
/*!
* @if jp
@@ -463,6 +466,7 @@
private:
std::vector<Entry> m_listeners;
+ coil::Mutex m_mutex;
};
@@ -486,6 +490,7 @@
class ConfigurationSetListenerHolder
{
typedef std::pair<ConfigurationSetListener*, bool> Entry;
+ typedef coil::Guard<coil::Mutex> Guard;
public:
/*!
* @if jp
@@ -569,6 +574,7 @@
private:
std::vector<Entry> m_listeners;
+ coil::Mutex m_mutex;
};
@@ -592,6 +598,7 @@
class ConfigurationSetNameListenerHolder
{
typedef std::pair<ConfigurationSetNameListener*, bool> Entry;
+ typedef coil::Guard<coil::Mutex> Guard;
public:
/*!
* @if jp
@@ -674,6 +681,7 @@
private:
std::vector<Entry> m_listeners;
+ coil::Mutex m_mutex;
};
//------------------------------------------------------------
Modified: branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ConnectorListener.cpp
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ConnectorListener.cpp 2011-05-23 19:57:18 UTC (rev 2126)
+++ branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ConnectorListener.cpp 2011-05-24 03:46:35 UTC (rev 2127)
@@ -53,6 +53,7 @@
ConnectorDataListenerHolder::~ConnectorDataListenerHolder()
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
if (m_listeners[i].second)
@@ -66,6 +67,7 @@
void ConnectorDataListenerHolder::
addListener(ConnectorDataListener* listener, bool autoclean)
{
+ Guard guard(m_mutex);
m_listeners.push_back(Entry(listener, autoclean));
}
@@ -73,6 +75,7 @@
void ConnectorDataListenerHolder::
removeListener(ConnectorDataListener* listener)
{
+ Guard guard(m_mutex);
std::vector<Entry>::iterator it(m_listeners.begin());
for (; it != m_listeners.end(); ++it)
{
@@ -93,6 +96,7 @@
void ConnectorDataListenerHolder::notify(const ConnectorInfo& info,
const cdrMemoryStream& cdrdata)
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
m_listeners[i].first->operator()(info, cdrdata);
@@ -114,6 +118,7 @@
ConnectorListenerHolder::~ConnectorListenerHolder()
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
if (m_listeners[i].second)
@@ -127,12 +132,14 @@
void ConnectorListenerHolder::addListener(ConnectorListener* listener,
bool autoclean)
{
+ Guard guard(m_mutex);
m_listeners.push_back(Entry(listener, autoclean));
}
void ConnectorListenerHolder::removeListener(ConnectorListener* listener)
{
+ Guard guard(m_mutex);
std::vector<Entry>::iterator it(m_listeners.begin());
for (; it != m_listeners.end(); ++it)
@@ -153,6 +160,7 @@
void ConnectorListenerHolder::notify(const ConnectorInfo& info)
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
m_listeners[i].first->operator()(info);
Modified: branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ConnectorListener.h
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ConnectorListener.h 2011-05-23 19:57:18 UTC (rev 2126)
+++ branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/ConnectorListener.h 2011-05-24 03:46:35 UTC (rev 2127)
@@ -22,6 +22,8 @@
#include <vector>
#include <utility>
+#include <coil/Mutex.h>
+#include <coil/Guard.h>
#include <rtm/RTC.h>
#include <rtm/ConnectorBase.h>
@@ -602,6 +604,7 @@
class ConnectorDataListenerHolder
{
typedef std::pair<ConnectorDataListener*, bool> Entry;
+ typedef coil::Guard<coil::Mutex> Guard;
public:
/*!
* @if jp
@@ -686,6 +689,7 @@
private:
std::vector<Entry> m_listeners;
+ coil::Mutex m_mutex;
};
@@ -707,6 +711,7 @@
class ConnectorListenerHolder
{
typedef std::pair<ConnectorListener*, bool> Entry;
+ typedef coil::Guard<coil::Mutex> Guard;
public:
/*!
* @if jp
@@ -789,6 +794,7 @@
private:
std::vector<Entry> m_listeners;
+ coil::Mutex m_mutex;
};
/*!
Modified: branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/PortConnectListener.cpp
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/PortConnectListener.cpp 2011-05-23 19:57:18 UTC (rev 2126)
+++ branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/PortConnectListener.cpp 2011-05-24 03:46:35 UTC (rev 2127)
@@ -101,6 +101,7 @@
PortConnectListenerHolder::~PortConnectListenerHolder()
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
if (m_listeners[i].second)
@@ -114,12 +115,14 @@
void PortConnectListenerHolder::addListener(PortConnectListener* listener,
bool autoclean)
{
+ Guard guard(m_mutex);
m_listeners.push_back(Entry(listener, autoclean));
}
void PortConnectListenerHolder::removeListener(PortConnectListener* listener)
{
+ Guard guard(m_mutex);
std::vector<Entry>::iterator it(m_listeners.begin());
for (; it != m_listeners.end(); ++it)
@@ -141,6 +144,7 @@
void PortConnectListenerHolder::notify(const char* portname,
RTC::ConnectorProfile& profile)
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
m_listeners[i].first->operator()(portname, profile);
@@ -162,6 +166,7 @@
PortConnectRetListenerHolder::~PortConnectRetListenerHolder()
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
if (m_listeners[i].second)
@@ -175,6 +180,7 @@
void PortConnectRetListenerHolder::
addListener(PortConnectRetListener* listener, bool autoclean)
{
+ Guard guard(m_mutex);
m_listeners.push_back(Entry(listener, autoclean));
}
@@ -182,6 +188,7 @@
void PortConnectRetListenerHolder::
removeListener(PortConnectRetListener* listener)
{
+ Guard guard(m_mutex);
std::vector<Entry>::iterator it(m_listeners.begin());
for (; it != m_listeners.end(); ++it)
{
@@ -203,6 +210,7 @@
RTC::ConnectorProfile& profile,
ReturnCode_t ret)
{
+ Guard guard(m_mutex);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
m_listeners[i].first->operator()(portname, profile, ret);
Modified: branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/PortConnectListener.h
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/PortConnectListener.h 2011-05-23 19:57:18 UTC (rev 2126)
+++ branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/PortConnectListener.h 2011-05-24 03:46:35 UTC (rev 2127)
@@ -21,6 +21,8 @@
#include <vector>
#include <utility>
+#include <coil/Mutex.h>
+#include <coil/Guard.h>
#include <rtm/RTC.h>
#include <rtm/idl/RTCSkel.h>
@@ -274,6 +276,7 @@
class PortConnectListenerHolder
{
typedef std::pair<PortConnectListener*, bool> Entry;
+ typedef coil::Guard<coil::Mutex> Guard;
public:
/*!
* @if jp
@@ -356,6 +359,7 @@
private:
std::vector<Entry> m_listeners;
+ coil::Mutex m_mutex;
};
@@ -378,6 +382,7 @@
class PortConnectRetListenerHolder
{
typedef std::pair<PortConnectRetListener*, bool> Entry;
+ typedef coil::Guard<coil::Mutex> Guard;
public:
/*!
* @if jp
@@ -463,6 +468,7 @@
private:
std::vector<Entry> m_listeners;
+ coil::Mutex m_mutex;
};
/*!
openrtm-commit メーリングリストの案内