[PATCH/RFC v2 0/2] libv4l2: fix deadlock when DQBUF in block mode

2014-06-09 Thread Thiago Santos
Hello, thanks for the reviews and comments. I updated the example as suggested by Mauro and reimplemented the deadlock fix as suggested by Hans. Here is the second version of those patches. Thiago Santos (2): v4l2grab: Add threaded producer/consumer option libv4l2: release the lock before

[PATCH/RFC v2 1/2] v4l2grab: Add threaded producer/consumer option

2014-06-09 Thread Thiago Santos
-by: Thiago Santos ts.san...@sisa.samsung.com --- contrib/test/Makefile.am | 2 +- contrib/test/v4l2grab.c | 261 +++ 2 files changed, 219 insertions(+), 44 deletions(-) diff --git a/contrib/test/Makefile.am b/contrib/test/Makefile.am index 80c7665

[PATCH/RFC v2 2/2] libv4l2: release the lock before doing a DQBUF

2014-06-09 Thread Thiago Santos
In blocking mode, if there are no buffers available the DQBUF will block waiting for a QBUF to be called but it will block holding the streaming lock which will prevent any QBUF from happening, causing a deadlock. Can be tested with: v4l2grab -t -b -s 2000 Signed-off-by: Thiago Santos ts.san

[PATCH/RFC 2/2] libv4l2: release the lock before doing a DQBUF

2014-06-05 Thread Thiago Santos
In blocking mode, if there are no buffers available the DQBUF will block waiting for a QBUF to be called but it will block holding the streaming lock which will prevent any QBUF from happening, causing a deadlock. Can be tested with: v4l2grab -t 1 -b 1 -s 2000 Signed-off-by: Thiago Santos ts.san

[PATCH/RFC 1/2] v4l2grab: Add threaded producer/consumer option

2014-06-05 Thread Thiago Santos
-off-by: Thiago Santos ts.san...@sisa.samsung.com --- contrib/test/Makefile.am | 2 +- contrib/test/v4l2grab.c | 265 +++ 2 files changed, 223 insertions(+), 44 deletions(-) diff --git a/contrib/test/Makefile.am b/contrib/test/Makefile.am index

[PATCH/RFC 0/2] libv4l2: fix deadlock when DQBUF in block mode

2014-06-05 Thread Thiago Santos
but, as it blocks holding the stream_lock, a QBUF will never happen and we have a deadlock. Thiago Santos (2): v4l2grab: Add threaded producer/consumer option libv4l2: release the lock before doing a DQBUF contrib/test/Makefile.am | 2 +- contrib/test/v4l2grab.c | 265