summary refs log tree commit diff stats
path: root/libcacard/event.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-06-11 15:36:48 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-06-11 15:36:48 +0100
commitc5cb1afc4675bf5ff66e7a149d2a8cffba2eaa9e (patch)
tree37b28935513fd5afdc5d08bc4f16ed9635272db3 /libcacard/event.c
parentb780bf8eff43fc49b071795292dea5d05990fff3 (diff)
parent1c33ac5716af0840d8a2c568a47bcbee51946d69 (diff)
downloadfocaccia-qemu-c5cb1afc4675bf5ff66e7a149d2a8cffba2eaa9e.tar.gz
focaccia-qemu-c5cb1afc4675bf5ff66e7a149d2a8cffba2eaa9e.zip
Merge remote-tracking branch 'remotes/bonzini/configure' into staging
* remotes/bonzini/configure:
  rules.mak: Rewrite unnest-vars
  configure: unset interfering variables
  configure: duplicate/incorrect order of -lrt
  libcacard: improve documentation
  libcacard: actually use symbols file
  libcacard: replace qemu thread primitives with glib ones
  vscclient: use glib thread primitives not qemu
  glib-compat.h: add new thread API emulation on top of pre-2.31 API

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'libcacard/event.c')
-rw-r--r--libcacard/event.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/libcacard/event.c b/libcacard/event.c
index a2e6c7dcd0..4c551e4e38 100644
--- a/libcacard/event.c
+++ b/libcacard/event.c
@@ -6,7 +6,6 @@
  */
 
 #include "qemu-common.h"
-#include "qemu/thread.h"
 
 #include "vcard.h"
 #include "vreader.h"
@@ -43,13 +42,11 @@ vevent_delete(VEvent *vevent)
 
 static VEvent *vevent_queue_head;
 static VEvent *vevent_queue_tail;
-static QemuMutex vevent_queue_lock;
-static QemuCond vevent_queue_condition;
+static CompatGMutex vevent_queue_lock;
+static CompatGCond vevent_queue_condition;
 
 void vevent_queue_init(void)
 {
-    qemu_mutex_init(&vevent_queue_lock);
-    qemu_cond_init(&vevent_queue_condition);
     vevent_queue_head = vevent_queue_tail = NULL;
 }
 
@@ -57,7 +54,7 @@ void
 vevent_queue_vevent(VEvent *vevent)
 {
     vevent->next = NULL;
-    qemu_mutex_lock(&vevent_queue_lock);
+    g_mutex_lock(&vevent_queue_lock);
     if (vevent_queue_head) {
         assert(vevent_queue_tail);
         vevent_queue_tail->next = vevent;
@@ -65,8 +62,8 @@ vevent_queue_vevent(VEvent *vevent)
         vevent_queue_head = vevent;
     }
     vevent_queue_tail = vevent;
-    qemu_cond_signal(&vevent_queue_condition);
-    qemu_mutex_unlock(&vevent_queue_lock);
+    g_cond_signal(&vevent_queue_condition);
+    g_mutex_unlock(&vevent_queue_lock);
 }
 
 /* must have lock */
@@ -86,11 +83,11 @@ VEvent *vevent_wait_next_vevent(void)
 {
     VEvent *vevent;
 
-    qemu_mutex_lock(&vevent_queue_lock);
+    g_mutex_lock(&vevent_queue_lock);
     while ((vevent = vevent_dequeue_vevent()) == NULL) {
-        qemu_cond_wait(&vevent_queue_condition, &vevent_queue_lock);
+        g_cond_wait(&vevent_queue_condition, &vevent_queue_lock);
     }
-    qemu_mutex_unlock(&vevent_queue_lock);
+    g_mutex_unlock(&vevent_queue_lock);
     return vevent;
 }
 
@@ -98,9 +95,9 @@ VEvent *vevent_get_next_vevent(void)
 {
     VEvent *vevent;
 
-    qemu_mutex_lock(&vevent_queue_lock);
+    g_mutex_lock(&vevent_queue_lock);
     vevent = vevent_dequeue_vevent();
-    qemu_mutex_unlock(&vevent_queue_lock);
+    g_mutex_unlock(&vevent_queue_lock);
     return vevent;
 }