summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/collections.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/core/collections.c b/src/core/collections.c
index 2f28857..d045e5a 100644
--- a/src/core/collections.c
+++ b/src/core/collections.c
@@ -43,7 +43,7 @@ static GType *_collection_definitions = NULL;
static uint32_t _collection_definitions_count = 0;
/* Verrou pour des accès atomiques */
-/* ... */
+G_LOCK_DEFINE_STATIC(_collec_mutex);
@@ -63,7 +63,7 @@ uint32_t register_collection_type(GType items)
{
uint32_t result; /* Identifiant à retourner */
- /* TODO : lock */
+ G_LOCK(_collec_mutex);
result = _collection_definitions_count++;
@@ -72,7 +72,7 @@ uint32_t register_collection_type(GType items)
_collection_definitions[result] = items;
- /* TODO : unlock */
+ G_UNLOCK(_collec_mutex);
return result;
@@ -168,6 +168,8 @@ GList *create_collections_list(void)
result = NULL;
+ G_LOCK(_collec_mutex);
+
for (i = 0; i < _collection_definitions_count; i++)
{
collec = g_object_new(_collection_definitions[i], NULL);
@@ -176,6 +178,8 @@ GList *create_collections_list(void)
}
+ G_UNLOCK(_collec_mutex);
+
return result;
}