Re: [linux-audio-dev] jack_ringbuffer_read_space() question

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] jack_ringbuffer_read_space() question
From: Tom Szilagyi (tszilagyi_AT_users.sourceforge.net)
Date: Mon Jul 12 2004 - 22:59:29 EEST


On Mon, Jul 12, 2004 at 08:20:08PM +0200, Florian Schmidt wrote:
> On Mon, 12 Jul 2004 16:52:40 +0200
> Tom Szilagyi <tszilagyi_AT_users.sourceforge.net> wrote:
> > [...]
> > I have a program with some (p)threads, and a jack ringbuffer. One
> > thread is writing to the ringbuffer, and another is reading from it.
> >
> > The question is: is it (thread-)safe to have a _third_ thread that
> > looks at the ringbuffer via jack_ringbuffer_read_space() at random
> > times to determine how much data is in the ringbuffer? This third
> > thread does not actually read nor write any data to/from the
> > ringbuffer, just wants to know the amount of data in it.
> > [...]
>
> As long as the third thread really never reads/writes any data from
> the ringbuffer it should be ok afaik.. But what is the purpose of
> that third thread? Do maybe the results of this third thread have
> side effects on the other two threads? Depending on what you do with
> the fill information of the ringbuffer you might get unexpected
> results..

Not really important, it's not even audio-related. (Just some private
play-around to learn new things...) I was just using the jack
ringbuffer interface, as it is a really appealing way of doing data
transfer between threads.

As Paul pointed out, the measurement is not very accurate, but that's
not a problem. I just need to make sure it never crashes/locks up.

So thanks for the answers,

Tom


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Mon Jul 12 2004 - 23:07:17 EEST