Add comment explaining NULL case in circular_buffer::enqueue and add logging to ::dequeue.
This commit is contained in:
parent
d6cba83322
commit
c5e0ea7276
1 changed files with 7 additions and 1 deletions
|
@ -91,7 +91,8 @@ circular_buffer::enqueue(void *src) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies data from this buffer to the "dst" address. The buffer is
|
* 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
|
void
|
||||||
circular_buffer::dequeue(void *dst) {
|
circular_buffer::dequeue(void *dst) {
|
||||||
|
@ -100,6 +101,11 @@ circular_buffer::dequeue(void *dst) {
|
||||||
I(dom, _unread <= _buffer_sz);
|
I(dom, _unread <= _buffer_sz);
|
||||||
I(dom, _buffer);
|
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) {
|
if (dst != NULL) {
|
||||||
memcpy(dst, &_buffer[_next], unit_sz);
|
memcpy(dst, &_buffer[_next], unit_sz);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue