public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea <mariofutire@googlemail.com>
To: linux-dvb@linuxtv.org
Subject: Re: [linux-dvb] Help using DMX_SET_BUFFER_SIZE
Date: Mon, 03 Mar 2008 19:49:10 +0000	[thread overview]
Message-ID: <47CC5636.3030807@googlemail.com> (raw)
In-Reply-To: <mailman.7.1204534746.20845.linux-dvb@linuxtv.org>

linux-dvb-request@linuxtv.org wrote:
> 
> 
> Possible solutions:
> 
> 2) enable the resize of a live ring buffer.
> Currently:
> 
> dvb_dvr_write DOES     lock the mutex (dmxdev->mutex)
> dvb_dvr_read  DOES NOT lock the mutex (the code to lock the mutex is there, but commented out, why?)
> 
> Is it enough to lock the mutex in dvb_dvr_read?

No, it isn't!

dvb_dmxdev_ts_callback is the function writing in the dvr_buffer, not dvb_dvr_write (which must be a 
system call I think).

Things get more complicated... I've understood that a callback function cannot sleep, so a mutex 
must not be used.
And a relocation of the buffer counts as reading and writing.

> Then the new function to change the buffer size could just lock the mutex, change the size and unlock.

How many readers of the dvr can there be? It looks like only 1 (otherwise the mutex would not be 
commented out).
Is it legal to write an application that reads dvr from one thread/process, and calls other ioctl 
from an other? I guess not, for the same reason why it cannot read from 2 threads.

So, if the above is true, I only need to synchronize with dvb_dmxdev_ts_callback, i.e. acquire the 
same spin_lock.

Does it make sense?

PS: It seems that I am replying my own emails... and I do that while I discover and understand more 
about the architecture of the dvr/demux.
What is a good starting point to get an idea about all those synchronization issues?
My next reading is the "Unreliable Guide To Locking".

More to follow...


_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

       reply	other threads:[~2008-03-03 19:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.7.1204534746.20845.linux-dvb@linuxtv.org>
2008-03-03 19:49 ` Andrea [this message]
2008-03-01  0:20 [linux-dvb] Help using DMX_SET_BUFFER_SIZE Andrea
2008-03-01  8:55 ` Florian Lohoff
2008-03-01  9:11   ` Andrea
2008-03-02 23:08   ` Andrea

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47CC5636.3030807@googlemail.com \
    --to=mariofutire@googlemail.com \
    --cc=linux-dvb@linuxtv.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox