[Spice-commits] 2 commits - server/tests
Frediano Ziglio
fziglio at kemper.freedesktop.org
Wed Sep 2 01:09:15 PDT 2015
server/tests/basic_event_loop.c | 8 ++++----
server/tests/replay.c | 11 ++++++-----
2 files changed, 10 insertions(+), 9 deletions(-)
New commits:
commit 2a09a5fa36763214fd0f03f57528eba9a878039f
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Tue Sep 1 17:14:19 2015 +0100
replay: compatibility with former version
GMutex usage in replay.c was not working so replace with plain pthread.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/server/tests/replay.c b/server/tests/replay.c
index 01590c0..efa97e9 100644
--- a/server/tests/replay.c
+++ b/server/tests/replay.c
@@ -12,6 +12,7 @@
#include <sys/wait.h>
#include <fcntl.h>
#include <glib.h>
+#include <pthread.h>
#include <spice/macros.h>
#include "red_replay_qxl.h"
@@ -30,7 +31,7 @@ static GMainLoop *loop = NULL;
static GAsyncQueue *aqueue = NULL;
static long total_size;
-static GMutex mutex;
+static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
static guint fill_source_id = 0;
@@ -102,9 +103,9 @@ static gboolean fill_queue_idle(gpointer user_data)
end:
if (!keep) {
- g_mutex_lock(&mutex);
+ pthread_mutex_lock(&mutex);
fill_source_id = 0;
- g_mutex_unlock(&mutex);
+ pthread_mutex_unlock(&mutex);
}
spice_qxl_wakeup(&display_sin);
@@ -113,7 +114,7 @@ end:
static void fill_queue(void)
{
- g_mutex_lock(&mutex);
+ pthread_mutex_lock(&mutex);
if (!started)
goto end;
@@ -124,7 +125,7 @@ static void fill_queue(void)
fill_source_id = g_idle_add(fill_queue_idle, NULL);
end:
- g_mutex_unlock(&mutex);
+ pthread_mutex_unlock(&mutex);
}
commit e5063799ab8909c37c286ecc584251be02934d7f
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Tue Sep 1 17:14:07 2015 +0100
replay: do not define same type twice
Avoid to use typedef twice for the same type as some compiler
complaints about it.
SpiceTimer and SpiceWatch are defined in server/spice-core.h
as an abstract type which should be defined by some code (as
server/tests/basic_event_loop.c does).
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/server/tests/basic_event_loop.c b/server/tests/basic_event_loop.c
index e692f3a..89e05ad 100644
--- a/server/tests/basic_event_loop.c
+++ b/server/tests/basic_event_loop.c
@@ -22,11 +22,11 @@ int debug = 0;
#define NOT_IMPLEMENTED printf("%s not implemented\n", __func__);
-typedef struct SpiceTimer {
+struct SpiceTimer {
SpiceTimerFunc func;
void *opaque;
guint source_id;
-} SpiceTimer;
+};
static SpiceTimer* timer_add(SpiceTimerFunc func, void *opaque)
{
@@ -71,12 +71,12 @@ static void timer_remove(SpiceTimer *timer)
g_free(timer);
}
-typedef struct SpiceWatch {
+struct SpiceWatch {
void *opaque;
guint source_id;
GIOChannel *channel;
SpiceWatchFunc func;
-} SpiceWatch;
+};
static GIOCondition spice_event_to_condition(int event_mask)
{
More information about the Spice-commits
mailing list