diff src/neon/rb.c @ 2183:b73ea297d197

- New version of ringbuffer code
author Ralf Ertzinger <ralf@skytale.net>
date Thu, 22 Nov 2007 15:51:52 +0100
parents 9a9f406374c6
children 89624b51e73d
line wrap: on
line diff
--- a/src/neon/rb.c	Thu Nov 22 02:54:06 2007 +0300
+++ b/src/neon/rb.c	Thu Nov 22 15:51:52 2007 +0100
@@ -343,12 +343,23 @@
     _ENTER;
 
     _RB_LOCK(rb->lock);
-    u = rb->used;
+    u = used_rb_locked(rb);
     _RB_UNLOCK(rb->lock);
 
     _LEAVE u;
 }
 
+/*
+ * Return the amount of used space currently in the rb.
+ * Assume the rb lock is already being held.
+ */
+unsigned int used_rb_locked(struct ringbuf* rb) {
+
+    _ENTER;
+
+    _LEAVE rb->used;
+}
+
 
 /*
  * destroy a ringbuffer