summaryrefslogtreecommitdiff
path: root/src/glibext/workqueue.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2024-08-25 17:04:01 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2024-08-25 17:04:01 (GMT)
commitab705b2c7fedce89ff08b36195706b2a1d9e1c42 (patch)
tree9615c3e47e4897d1dc4920d26fdc8da7eb01ac82 /src/glibext/workqueue.c
parenta0532508524a37444d15b878c5e494cd348b0cae (diff)
Mark 0 as a reserved work group identifier.
Diffstat (limited to 'src/glibext/workqueue.c')
-rw-r--r--src/glibext/workqueue.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/glibext/workqueue.c b/src/glibext/workqueue.c
index ad6ede6..fe7f1bb 100644
--- a/src/glibext/workqueue.c
+++ b/src/glibext/workqueue.c
@@ -247,8 +247,13 @@ wgroup_id_t g_work_queue_define_group(GWorkQueue *queue, guint count)
do
{
- result = queue->generator++;
+ result = ++queue->generator;
+
+ if (result == INVALID_GROUP_ID)
+ continue;
+
created = g_work_queue_ensure_group_exists(queue, result, count);
+
}
while (!created);