[openrtm-commit:03112] r3187 - branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm

openrtm @ openrtm.org openrtm @ openrtm.org
2018年 1月 23日 (火) 14:07:30 JST


Author: miyamoto
Date: 2018-01-23 14:07:30 +0900 (Tue, 23 Jan 2018)
New Revision: 3187

Modified:
   branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPort.h
Log:
[compat, ->RELENG_1_2] refs #4428

Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPort.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPort.h	2018-01-23 04:29:28 UTC (rev 3186)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPort.h	2018-01-23 05:07:30 UTC (rev 3187)
@@ -247,6 +247,17 @@
 			}
 			else
 			{
+				Guard guard(m_valueMutex);
+				if (m_onWriteConvert != NULL)
+				{
+					RTC_DEBUG(("m_connectors.OnWriteConvert called"));
+					m_directValue = ((*m_onWriteConvert)(value));
+				}
+				else
+				{
+					m_directValue = value;
+				}
+				m_directNewData = true;
 				ret = PORT_OK;
 			}
             m_status[i] = ret;
@@ -296,7 +307,6 @@
      */
     bool write()
     {
-		Guard guard(m_valueMutex);
       return write(m_value);
     }
     
@@ -496,18 +506,11 @@
 	{
 		Guard guard(m_valueMutex);
 		m_directNewData = false;
-		if (m_onWriteConvert != NULL)
-		{
-			data = (*m_onWriteConvert)(m_value);
-		}
-		else
-		{
-			data = m_value;
-		}
+		data = m_directValue;
 	}
 	bool isEmpty()
 	{
-		return false;
+		return !m_directNewData;
 	}
     
   private:
@@ -547,6 +550,7 @@
 
 	coil::Mutex m_valueMutex;
 	bool m_directNewData;
+	DataType m_directValue;
   };
 }; // namespace RTC
 



More information about the openrtm-commit mailing list