summaryrefslogtreecommitdiff
path: root/src/debug/remgdb
diff options
context:
space:
mode:
Diffstat (limited to 'src/debug/remgdb')
-rw-r--r--src/debug/remgdb/stream-int.h6
-rw-r--r--src/debug/remgdb/stream.c29
2 files changed, 17 insertions, 18 deletions
diff --git a/src/debug/remgdb/stream-int.h b/src/debug/remgdb/stream-int.h
index bdfe11a..b93ac48 100644
--- a/src/debug/remgdb/stream-int.h
+++ b/src/debug/remgdb/stream-int.h
@@ -49,11 +49,11 @@ struct _GGdbStream
GThread *listening; /* Thread pour les réceptions */
GGdbPacket *free_packets; /* Liste des disponibles */
- GMutex *free_mutex; /* Accès à la liste */
+ GMutex free_mutex; /* Accès à la liste */
GGdbPacket *recv_packets; /* Liste des paquets reçus */
- GCond *recv_cond; /* Attente de disponibilité */
- GMutex *recv_mutex; /* Accès à la liste */
+ GCond recv_cond; /* Attente de disponibilité */
+ GMutex recv_mutex; /* Accès à la liste */
};
diff --git a/src/debug/remgdb/stream.c b/src/debug/remgdb/stream.c
index 0ff442d..360c1cf 100644
--- a/src/debug/remgdb/stream.c
+++ b/src/debug/remgdb/stream.c
@@ -88,10 +88,10 @@ static void g_gdb_stream_class_init(GGdbStreamClass *klass)
static void g_gdb_stream_init(GGdbStream *stream)
{
- stream->free_mutex = g_mutex_new();
+ g_mutex_init(&stream->free_mutex);
- stream->recv_cond = g_cond_new();
- stream->recv_mutex = g_mutex_new();
+ g_cond_init(&stream->recv_cond);
+ g_mutex_init(&stream->recv_mutex);
}
@@ -111,11 +111,10 @@ static void g_gdb_stream_init(GGdbStream *stream)
bool g_gdb_stream_listen(GGdbStream *stream)
{
bool result; /* Bilan final à retourner */
- GError *error; /* Bilan de création de thread */
result = true;
- if (!g_thread_create((GThreadFunc)gdb_stream_thread, stream, FALSE, &error))
+ if (!g_thread_new("chrysalide_gdb_stream", (GThreadFunc)gdb_stream_thread, stream))
result = false;
return result;
@@ -203,11 +202,11 @@ static void *gdb_stream_thread(GGdbStream *stream)
/* On conserve le résultat */
- g_mutex_lock(stream->recv_mutex);
+ g_mutex_lock(&stream->recv_mutex);
g_gdb_packet_push(&stream->recv_packets, packet);
- g_mutex_unlock(stream->recv_mutex);
+ g_mutex_unlock(&stream->recv_mutex);
- g_cond_signal(stream->recv_cond);
+ g_cond_signal(&stream->recv_cond);
}
@@ -244,7 +243,7 @@ GGdbPacket *g_gdb_stream_get_free_packet(GGdbStream *stream)
{
GGdbPacket *result; /* Paquet à retourner */
- g_mutex_lock(stream->free_mutex);
+ g_mutex_lock(&stream->free_mutex);
if (dl_list_empty(stream->free_packets))
result = g_gdb_packet_new();
@@ -252,7 +251,7 @@ GGdbPacket *g_gdb_stream_get_free_packet(GGdbStream *stream)
else
result = g_gdb_packet_pop(&stream->free_packets);
- g_mutex_unlock(stream->free_mutex);
+ g_mutex_unlock(&stream->free_mutex);
return result;
@@ -274,11 +273,11 @@ GGdbPacket *g_gdb_stream_get_free_packet(GGdbStream *stream)
void g_gdb_stream_mark_packet_as_free(GGdbStream *stream, GGdbPacket *packet)
{
- g_mutex_lock(stream->free_mutex);
+ g_mutex_lock(&stream->free_mutex);
g_gdb_packet_push(&stream->free_packets, packet);
- g_mutex_unlock(stream->free_mutex);
+ g_mutex_unlock(&stream->free_mutex);
}
@@ -389,14 +388,14 @@ GGdbPacket *g_gdb_stream_recv_packet(GGdbStream *stream)
{
GGdbPacket *result; /* Paquet à retourner */
- g_mutex_lock(stream->recv_mutex);
+ g_mutex_lock(&stream->recv_mutex);
if (dl_list_empty(stream->recv_packets))
- g_cond_wait(stream->recv_cond, stream->recv_mutex);
+ g_cond_wait(&stream->recv_cond, &stream->recv_mutex);
result = g_gdb_packet_pop(&stream->recv_packets);
- g_mutex_unlock(stream->recv_mutex);
+ g_mutex_unlock(&stream->recv_mutex);
return result;