summaryrefslogtreecommitdiff
path: root/src/debug
diff options
context:
space:
mode:
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/remgdb/stream-int.h6
-rw-r--r--src/debug/remgdb/stream.c29
-rw-r--r--src/debug/stream-int.h6
-rw-r--r--src/debug/stream.c32
4 files changed, 35 insertions, 38 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;
diff --git a/src/debug/stream-int.h b/src/debug/stream-int.h
index 05b6c42..ea229ba 100644
--- a/src/debug/stream-int.h
+++ b/src/debug/stream-int.h
@@ -71,11 +71,11 @@ struct _GDebugStream
GType pkt_type; /* Type des paquets traités */
GDebugPacket *free_packets; /* Liste des disponibles */
- GMutex *free_mutex; /* Accès à la liste */
+ GMutex free_mutex; /* Accès à la liste */
GDebugPacket *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/stream.c b/src/debug/stream.c
index 5d91aa8..13bdb65 100644
--- a/src/debug/stream.c
+++ b/src/debug/stream.c
@@ -84,10 +84,10 @@ static void g_debug_stream_class_init(GDebugStreamClass *klass)
static void g_debug_stream_init(GDebugStream *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);
}
@@ -106,12 +106,10 @@ static void g_debug_stream_init(GDebugStream *stream)
bool g_debug_stream_connect(GDebugStream *stream)
{
- GError *error; /* Bilan de création de thread */
-
if (stream->connect == NULL || !stream->connect(stream))
return false;
- if (!g_thread_create((GThreadFunc)debug_stream_thread, stream, FALSE, &error))
+ if (!g_thread_new("chrysalide_stream", (GThreadFunc)debug_stream_thread, stream))
{
/* TODO : disconnect ! */
return false;
@@ -148,11 +146,11 @@ static void *debug_stream_thread(GDebugStream *stream)
if (stream->recv_packet(stream, packet))
{
- g_mutex_lock(stream->recv_mutex);
+ g_mutex_lock(&stream->recv_mutex);
g_debug_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);
}
else g_debug_stream_mark_packet_as_free(stream, packet);
@@ -180,7 +178,7 @@ GDebugPacket *g_debug_stream_get_free_packet(GDebugStream *stream)
{
GDebugPacket *result; /* Paquet à retourner */
- g_mutex_lock(stream->free_mutex);
+ g_mutex_lock(&stream->free_mutex);
if (dl_list_empty(stream->free_packets))
result = g_object_new(stream->pkt_type, NULL);
@@ -188,7 +186,7 @@ GDebugPacket *g_debug_stream_get_free_packet(GDebugStream *stream)
else
result = g_debug_packet_pop(&stream->free_packets);
- g_mutex_unlock(stream->free_mutex);
+ g_mutex_unlock(&stream->free_mutex);
return result;
@@ -212,11 +210,11 @@ void g_debug_stream_mark_packet_as_free(GDebugStream *stream, GDebugPacket *pack
{
stream->free_packet(stream, packet);
- g_mutex_lock(stream->free_mutex);
+ g_mutex_lock(&stream->free_mutex);
g_debug_packet_push(&stream->free_packets, packet);
- g_mutex_unlock(stream->free_mutex);
+ g_mutex_unlock(&stream->free_mutex);
}
@@ -263,7 +261,7 @@ GDebugPacket *g_debug_stream_recv_packet(GDebugStream *stream, filter_packet_fc
{
GDebugPacket *result; /* Paquet à retourner */
- g_mutex_lock(stream->recv_mutex);
+ g_mutex_lock(&stream->recv_mutex);
if (filter != NULL)
{
@@ -282,7 +280,7 @@ GDebugPacket *g_debug_stream_recv_packet(GDebugStream *stream, filter_packet_fc
if (result == NULL)
{
- g_cond_wait(stream->recv_cond, stream->recv_mutex);
+ g_cond_wait(&stream->recv_cond, &stream->recv_mutex);
goto gdsrp_try_again;
}
@@ -290,13 +288,13 @@ GDebugPacket *g_debug_stream_recv_packet(GDebugStream *stream, filter_packet_fc
else
{
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_debug_packet_pop(&stream->recv_packets);
}
- g_mutex_unlock(stream->recv_mutex);
+ g_mutex_unlock(&stream->recv_mutex);
return result;