[openrtm-commit:03202] r951 - trunk/OpenRTM-aist-Python/OpenRTM_aist
openrtm @ openrtm.org
openrtm @ openrtm.org
2018年 2月 28日 (水) 13:24:06 JST
Author: miyamoto
Date: 2018-02-28 13:24:05 +0900 (Wed, 28 Feb 2018)
New Revision: 951
Modified:
trunk/OpenRTM-aist-Python/OpenRTM_aist/RingBuffer.py
Log:
[bugfix, ->trunk] bug fixed. refs #4470
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/RingBuffer.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/RingBuffer.py 2018-02-28 03:28:01 UTC (rev 950)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/RingBuffer.py 2018-02-28 04:24:05 UTC (rev 951)
@@ -237,7 +237,8 @@
# ½ñ¤¹þ¤ß²Äǽ¤ÊÍ×ÁÇ¿ô°Ê¾å¤Î¿ôÃͤò»ØÄꤷ¤¿¾ì¹ç¡¢PRECONDITION_NOT_MET
# ¤òÊÖ¤¹¡£
#
- # @param n ½ñ¹þ¤ß¥Ý¥¤¥ó¥¿ + n ¤Î°ÌÃ֤Υݥ¤¥ó¥¿
+ # @param n ½ñ¹þ¤ß¥Ý¥¤¥ó¥¿ + n ¤Î°ÌÃ֤Υݥ¤¥ó¥¿
+ # @param unlock_enable True¤Î¾ì¹ç¤Ë¥Ð¥Ã¥Õ¥¡¥¨¥ó¥×¥Æ¥£¤Î¥Ö¥í¥Ã¥¯¤ò²ò½ü¤¹¤ë
# @return BUFFER_OK: Àµ¾ï½ªÎ»
# PRECONDITION_NOT_MET: n > writable()
#
@@ -247,14 +248,18 @@
#
# Pure virtual function to get the buffer length.
#
+ # @param n
+ # @param unlock_enable
+ #
# @return buffer length
#
# @endif
#
# ReturnCode advanceWptr(long int n = 1)
- def advanceWptr(self, n = 1):
- self._empty_cond.acquire()
- empty = self.empty()
+ def advanceWptr(self, n = 1, unlock_enable=True):
+ if unlock_enable and n > 0:
+ self._empty_cond.acquire()
+ empty = self.empty()
# n > 0 :
# n satisfies n <= writable elements
# n <= m_length - m_fillcout
@@ -270,10 +275,10 @@
self._wpos = (self._wpos + n + self._length) % self._length
self._fillcount += n
-
- if empty:
- self._empty_cond.notify()
- self._empty_cond.release()
+ if unlock_enable:
+ if empty and n > 0:
+ self._empty_cond.notify()
+ self._empty_cond.release()
return OpenRTM_aist.BufferStatus.BUFFER_OK
@@ -367,7 +372,7 @@
overwrite = False
if overwrite and not timedwrite: # "overwrite" mode
- self.advanceRptr()
+ self.advanceRptr(unlock_enable=False)
elif not overwrite and not timedwrite: # "do_nothing" mode
self._full_cond.release()
@@ -491,7 +496,8 @@
#
# ¸½ºß¤ÎÆɤ߽Ф·°ÌÃ֤Υݥ¤¥ó¥¿¤ò n ¸Ä¿Ê¤á¤ë¡£
#
- # @param n Æɤ߽Ф·¥Ý¥¤¥ó¥¿ + n ¤Î°ÌÃ֤Υݥ¤¥ó¥¿
+ # @param n Æɤ߽Ф·¥Ý¥¤¥ó¥¿ + n ¤Î°ÌÃ֤Υݥ¤¥ó¥¿
+ # @param unlock_enable True¤Î¾ì¹ç¤Ë¥Ð¥Ã¥Õ¥¡¥Õ¥ë¤Î¥Ö¥í¥Ã¥¯¤ò²ò½ü¤¹¤ë
# @return BUFFER_OK: Àµ¾ï½ªÎ»
# BUFFER_ERROR: °Û¾ï½ªÎ»
#
@@ -501,14 +507,18 @@
#
# Pure virtual function to get the buffer length.
#
+ # @param n
+ # @param unlock_enable
+ #
# @return buffer length
#
# @endif
#
# DataType* rptr(long int n = 0)
- def advanceRptr(self, n = 1):
- self._full_cond.acquire()
- full_ = self.full()
+ def advanceRptr(self, n = 1, unlock_enable=True):
+ if unlock_enable and n > 0:
+ self._full_cond.acquire()
+ full_ = self.full()
# n > 0 :
# n satisfies n <= readable elements
# n <= m_fillcout
@@ -525,11 +535,11 @@
+ if unlock_enable and n > 0:
+ if full_:
+ self._full_cond.notify()
+ self._full_cond.release()
- if full_:
- self._full_cond.notify()
- self._full_cond.release()
-
return OpenRTM_aist.BufferStatus.BUFFER_OK
More information about the openrtm-commit
mailing list