[libbluray-devel] bd_reg_write(): no need to lock bd state when BD-J is communicating with libbdplus

npzacs git at videolan.org
Sun Dec 1 18:01:02 CET 2013


libbluray | branch: master | npzacs <npzacs at gmail.com> | Sun Dec  1 19:00:11 2013 +0200| [0c83ca66225b3be41a888bfe05624eba39610090] | committer: npzacs

bd_reg_write(): no need to lock bd state when BD-J is communicating with libbdplus

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=0c83ca66225b3be41a888bfe05624eba39610090
---

 src/libbluray/bluray.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index f5580fb..0055ecd 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -986,9 +986,14 @@ uint32_t bd_reg_read(BLURAY *bd, int psr, int reg)
 int bd_reg_write(BLURAY *bd, int psr, int reg, uint32_t value)
 {
     if (psr) {
-        bd_mutex_lock(&bd->mutex); /* avoid deadlocks (psr_write triggers callbacks that may lock this mutex) */
+        if (psr < 102) {
+            /* avoid deadlocks (psr_write triggers callbacks that may lock this mutex) */
+            bd_mutex_lock(&bd->mutex);
+        }
         int res = bd_psr_write(bd->regs, reg, value);
-        bd_mutex_unlock(&bd->mutex);
+        if (psr < 102) {
+            bd_mutex_unlock(&bd->mutex);
+        }
         return res;
     } else {
         return bd_gpr_write(bd->regs, reg, value);



More information about the libbluray-devel mailing list