diff options
author | michaelld <michaelld@221aa14e-8319-0410-a670-987f0aec2ac5> | 2007-08-17 03:18:37 +0000 |
---|---|---|
committer | michaelld <michaelld@221aa14e-8319-0410-a670-987f0aec2ac5> | 2007-08-17 03:18:37 +0000 |
commit | d5d0ca37f209d85298f46fa730abed5fa671174f (patch) | |
tree | 9c083f92abab3e4ca0d6153c108aefc5b7487ddc /gr-audio-osx/src/circular_buffer.h | |
parent | 667e15dd9d22c761d9fb4603b1f67912d4eff245 (diff) |
added some debugging comments; fixed a bug in the circular buffer so
that the internal mutex is released correctly and new data overwrites
older data when an overrun occurs and writing is not blocked.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6145 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-audio-osx/src/circular_buffer.h')
-rw-r--r-- | gr-audio-osx/src/circular_buffer.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gr-audio-osx/src/circular_buffer.h b/gr-audio-osx/src/circular_buffer.h index 984182dd2b..4b5e7ba351 100644 --- a/gr-audio-osx/src/circular_buffer.h +++ b/gr-audio-osx/src/circular_buffer.h @@ -159,6 +159,8 @@ public: d_internal->unlock (); return (2); } + // set the return value to 1: success; change if needed + int retval = 1; if (bufLen_I > d_n_avail_write_I) { if (d_doWriteBlock) { while (bufLen_I > d_n_avail_write_I) { @@ -185,7 +187,7 @@ public: #if DO_DEBUG fprintf (stderr, "circular_buffer::enqueue: overflow\n"); #endif - return (-1); + retval = -1; } } UInt32 n_now_I = d_bufLen_I - d_writeNdx_I, n_start_I = 0; @@ -203,7 +205,7 @@ public: d_n_avail_write_I -= bufLen_I; d_readBlock->signal (); d_internal->unlock (); - return (1); + return (retval); }; /* |