All instances where they were used have now been converted to the Glib
equivalents.
Signed-off-by: Rafael Fonseca <r4f4rfs(a)gmail.com>
---
examples/systemtap/lock-debug.stp | 4 +-
src/libvirt_private.syms | 11 ----
src/util/virthread.c | 101 ------------------------------
src/util/virthread.h | 41 ------------
4 files changed, 2 insertions(+), 155 deletions(-)
diff --git a/examples/systemtap/lock-debug.stp b/examples/systemtap/lock-debug.stp
index 0c9cc38692..dd8ee42b54 100644
--- a/examples/systemtap/lock-debug.stp
+++ b/examples/systemtap/lock-debug.stp
@@ -35,12 +35,12 @@ probe library = process( %( $# > 0 %? @1 %:
"/usr/lib/libvirt.so" %) )
if (filter()) next
}
-probe lock = library.function("virMutexLock")
+probe lock = library.function("g_mutex_lock")
{
lockname = usymdata($m)
}
-probe unlock = library.function("virMutexUnlock")
+probe unlock = library.function("g_mutex_unlock")
{
lockname = usymdata($m)
}
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 4dfafdfd3e..054a1a5fce 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3259,17 +3259,6 @@ virSystemdTerminateMachine;
# util/virthread.h
-virCondBroadcast;
-virCondDestroy;
-virCondInit;
-virCondSignal;
-virCondWait;
-virCondWaitUntil;
-virMutexDestroy;
-virMutexInit;
-virMutexInitRecursive;
-virMutexLock;
-virMutexUnlock;
virOnce;
virThreadCancel;
virThreadCreateFull;
diff --git a/src/util/virthread.c b/src/util/virthread.c
index 1ec5096ced..5300273f0e 100644
--- a/src/util/virthread.c
+++ b/src/util/virthread.c
@@ -43,107 +43,6 @@ int virOnce(virOnceControlPtr once, virOnceFunc init)
}
-int virMutexInit(virMutexPtr m)
-{
- int ret;
- pthread_mutexattr_t attr;
- pthread_mutexattr_init(&attr);
- pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
- ret = pthread_mutex_init(&m->lock, &attr);
- pthread_mutexattr_destroy(&attr);
- if (ret != 0) {
- errno = ret;
- return -1;
- }
- return 0;
-}
-
-int virMutexInitRecursive(virMutexPtr m)
-{
- int ret;
- pthread_mutexattr_t attr;
- pthread_mutexattr_init(&attr);
- pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
- ret = pthread_mutex_init(&m->lock, &attr);
- pthread_mutexattr_destroy(&attr);
- if (ret != 0) {
- errno = ret;
- return -1;
- }
- return 0;
-}
-
-void virMutexDestroy(virMutexPtr m)
-{
- pthread_mutex_destroy(&m->lock);
-}
-
-void virMutexLock(virMutexPtr m)
-{
- pthread_mutex_lock(&m->lock);
-}
-
-void virMutexUnlock(virMutexPtr m)
-{
- pthread_mutex_unlock(&m->lock);
-}
-
-
-int virCondInit(virCondPtr c)
-{
- int ret;
- if ((ret = pthread_cond_init(&c->cond, NULL)) != 0) {
- errno = ret;
- return -1;
- }
- return 0;
-}
-
-int virCondDestroy(virCondPtr c)
-{
- int ret;
- if ((ret = pthread_cond_destroy(&c->cond)) != 0) {
- errno = ret;
- return -1;
- }
- return 0;
-}
-
-int virCondWait(virCondPtr c, virMutexPtr m)
-{
- int ret;
- if ((ret = pthread_cond_wait(&c->cond, &m->lock)) != 0) {
- errno = ret;
- return -1;
- }
- return 0;
-}
-
-int virCondWaitUntil(virCondPtr c, virMutexPtr m, unsigned long long whenms)
-{
- int ret;
- struct timespec ts;
-
- ts.tv_sec = whenms / 1000;
- ts.tv_nsec = (whenms % 1000) * 1000000;
-
- if ((ret = pthread_cond_timedwait(&c->cond, &m->lock, &ts)) != 0)
{
- errno = ret;
- return -1;
- }
- return 0;
-}
-
-void virCondSignal(virCondPtr c)
-{
- pthread_cond_signal(&c->cond);
-}
-
-void virCondBroadcast(virCondPtr c)
-{
- pthread_cond_broadcast(&c->cond);
-}
-
struct virThreadArgs {
virThreadFunc func;
char *name;
diff --git a/src/util/virthread.h b/src/util/virthread.h
index a57c99bdf0..d55407d693 100644
--- a/src/util/virthread.h
+++ b/src/util/virthread.h
@@ -26,20 +26,6 @@
#include <pthread.h>
-typedef struct virMutex virMutex;
-typedef virMutex *virMutexPtr;
-
-struct virMutex {
- pthread_mutex_t lock;
-};
-
-typedef struct virCond virCond;
-typedef virCond *virCondPtr;
-
-struct virCond {
- pthread_cond_t cond;
-};
-
typedef struct virThreadLocal virThreadLocal;
typedef virThreadLocal *virThreadLocalPtr;
@@ -62,11 +48,6 @@ struct virOnceControl {
};
-#define VIR_MUTEX_INITIALIZER \
- { \
- .lock = PTHREAD_MUTEX_INITIALIZER \
- }
-
#define VIR_ONCE_CONTROL_INITIALIZER \
{ \
.once = PTHREAD_ONCE_INIT \
@@ -117,28 +98,6 @@ unsigned long long virThreadID(virThreadPtr thread);
int virOnce(virOnceControlPtr once, virOnceFunc init)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
-int virMutexInit(virMutexPtr m) G_GNUC_WARN_UNUSED_RESULT;
-int virMutexInitRecursive(virMutexPtr m) G_GNUC_WARN_UNUSED_RESULT;
-void virMutexDestroy(virMutexPtr m);
-
-void virMutexLock(virMutexPtr m);
-void virMutexUnlock(virMutexPtr m);
-
-
-int virCondInit(virCondPtr c) G_GNUC_WARN_UNUSED_RESULT;
-int virCondDestroy(virCondPtr c);
-
-/* virCondWait, virCondWaitUntil:
- * These functions can return without the associated predicate
- * changing value. Therefore in nearly all cases they
- * should be enclosed in a while loop that checks the predicate.
- */
-int virCondWait(virCondPtr c, virMutexPtr m) G_GNUC_WARN_UNUSED_RESULT;
-int virCondWaitUntil(virCondPtr c, virMutexPtr m, unsigned long long whenms)
G_GNUC_WARN_UNUSED_RESULT;
-
-void virCondSignal(virCondPtr c);
-void virCondBroadcast(virCondPtr c);
-
typedef void (*virThreadLocalCleanup)(void *);
int virThreadLocalInit(virThreadLocalPtr l,
--
2.25.2