From c5e0ea727634cabda067c80520946eed7579cd96 Mon Sep 17 00:00:00 2001 From: Michael Bebenita Date: Wed, 28 Jul 2010 00:01:31 -0700 Subject: [PATCH] Add comment explaining NULL case in circular_buffer::enqueue and add logging to ::dequeue. --- src/rt/circular_buffer.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/rt/circular_buffer.cpp b/src/rt/circular_buffer.cpp index 640809e048f..1b626920694 100644 --- a/src/rt/circular_buffer.cpp +++ b/src/rt/circular_buffer.cpp @@ -91,7 +91,8 @@ circular_buffer::enqueue(void *src) { /** * Copies data from this buffer to the "dst" address. The buffer is - * shrunk if possible. + * shrunk if possible. If the "dst" address is NULL, then the message + * is dequeued but is not copied. */ void circular_buffer::dequeue(void *dst) { @@ -100,6 +101,11 @@ circular_buffer::dequeue(void *dst) { I(dom, _unread <= _buffer_sz); I(dom, _buffer); + dom->log(rust_log::MEM | rust_log::COMM, + "circular_buffer dequeue " + "unread: %d, buffer_sz: %d, unit_sz: %d", + _unread, _buffer_sz, unit_sz); + if (dst != NULL) { memcpy(dst, &_buffer[_next], unit_sz); }