aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Bebenita <[email protected]>2010-07-28 00:01:31 -0700
committerGraydon Hoare <[email protected]>2010-07-28 20:30:29 -0700
commitc5e0ea727634cabda067c80520946eed7579cd96 (patch)
treefcc140852b404ec4cc638c3c2c3c77d4f0591756
parentAdd peek method to circular buffer. (diff)
downloadrust-c5e0ea727634cabda067c80520946eed7579cd96.tar.xz
rust-c5e0ea727634cabda067c80520946eed7579cd96.zip
Add comment explaining NULL case in circular_buffer::enqueue and add logging to ::dequeue.
-rw-r--r--src/rt/circular_buffer.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rt/circular_buffer.cpp b/src/rt/circular_buffer.cpp
index 640809e0..1b626920 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);
}