summary refs log tree commit diff stats
path: root/stubs/iothread-lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'stubs/iothread-lock.c')
-rw-r--r--stubs/iothread-lock.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/stubs/iothread-lock.c b/stubs/iothread-lock.c
index d7890e5581..5467659895 100644
--- a/stubs/iothread-lock.c
+++ b/stubs/iothread-lock.c
@@ -1,6 +1,8 @@
 #include "qemu/osdep.h"
 #include "qemu/main-loop.h"
 
+static uint32_t bql_unlock_blocked;
+
 bool bql_locked(void)
 {
     return false;
@@ -12,4 +14,17 @@ void bql_lock_impl(const char *file, int line)
 
 void bql_unlock(void)
 {
+    assert(!bql_unlock_blocked);
+}
+
+void bql_block_unlock(bool increase)
+{
+    uint32_t new_value;
+
+    assert(bql_locked());
+
+    /* check for overflow! */
+    new_value = bql_unlock_blocked + increase - !increase;
+    assert((new_value > bql_unlock_blocked) == increase);
+    bql_unlock_blocked = new_value;
 }