[libvirt PATCH 7/7] virMutex*: Fail loudly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make failure to lock, unlock or destroy mutexes visible in the CI.

As "abort()" is quite a harsh treatment and pthread generally speaking
"does the right thing" regardless, limit this to analysis builds in
the CI as to not bother users but still make developers aware of issues.

Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/util/virthread.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/util/virthread.c b/src/util/virthread.c
index f64dbee9e9..95213bd511 100644
--- a/src/util/virthread.c
+++ b/src/util/virthread.c
@@ -88,6 +88,9 @@ void virMutexDestroy(virMutex *m)
 {
     if (pthread_mutex_destroy(&m->lock)) {
         VIR_WARN("Failed to destroy mutex=%p", m);
+#if DYNAMIC_ANALYSIS
+        abort();
+#endif
     }
 }
 
@@ -95,6 +98,9 @@ void virMutexLock(virMutex *m)
 {
     if (pthread_mutex_lock(&m->lock)) {
         VIR_WARN("Failed to lock mutex=%p", m);
+#if DYNAMIC_ANALYSIS
+        abort();
+#endif
     }
 }
 
@@ -102,6 +108,9 @@ void virMutexUnlock(virMutex *m)
 {
     if (pthread_mutex_unlock(&m->lock)) {
         VIR_WARN("Failed to unlock mutex=%p", m);
+#if DYNAMIC_ANALYSIS
+        abort();
+#endif
     }
 }
 
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux