summaryrefslogtreecommitdiff
path: root/src/glibext
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-06-04 17:58:34 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-06-04 17:58:48 (GMT)
commit1f2b71e31326a5bc021785888cd2203010acf4e6 (patch)
treeb82fd64f1137a09553aa2cb513f974e1308e3022 /src/glibext
parenta7f73441a0d466824798a421f369628db0184030 (diff)
Defined the number of threads to run from a centralized function.
Diffstat (limited to 'src/glibext')
-rw-r--r--src/glibext/delayed.c5
-rw-r--r--src/glibext/gwidthtracker.c3
-rw-r--r--src/glibext/signal.c2
3 files changed, 6 insertions, 4 deletions
diff --git a/src/glibext/delayed.c b/src/glibext/delayed.c
index caffbaa..6e81c4b 100644
--- a/src/glibext/delayed.c
+++ b/src/glibext/delayed.c
@@ -32,6 +32,7 @@
#include "delayed-int.h"
+#include "../core/nproc.h"
#include "../gui/core/global.h"
@@ -396,7 +397,7 @@ static void g_work_group_init(GWorkGroup *group)
g_atomic_int_set(&group->pending, 0);
group->threads = NULL;
- group->threads_count = g_get_num_processors();
+ group->threads_count = 0;
group->force_exit = false;
group->callback = NULL;
@@ -501,7 +502,7 @@ static GWorkGroup *g_work_group_new(wgroup_id_t id, const guint *count)
result->id = id;
- result->threads_count = g_get_num_processors();
+ result->threads_count = get_max_online_threads();
if (count != NULL && *count < result->threads_count)
result->threads_count = *count;
diff --git a/src/glibext/gwidthtracker.c b/src/glibext/gwidthtracker.c
index 181759c..0741133 100644
--- a/src/glibext/gwidthtracker.c
+++ b/src/glibext/gwidthtracker.c
@@ -36,6 +36,7 @@
#include "delayed-int.h"
#include "gbuffercache.h"
#include "../core/global.h"
+#include "../core/nproc.h"
@@ -986,7 +987,7 @@ void g_width_tracker_build_initial_cache(GWidthTracker *tracker, wgroup_id_t gid
/* Lancement des traitements */
- runs_count = g_get_num_processors();
+ runs_count = get_max_online_threads();
updates = (GWidthUpdate **)calloc(runs_count, sizeof(GWidthUpdate *));
diff --git a/src/glibext/signal.c b/src/glibext/signal.c
index c1a977d..9a3c0e3 100644
--- a/src/glibext/signal.c
+++ b/src/glibext/signal.c
@@ -1,6 +1,6 @@
/* Chrysalide - Outil d'analyse de fichiers binaires
- * signal.h - prototypes pour un encadrement des signaux supplémentaire par rapport à celui de la GLib
+ * signal.c - encadrement des signaux supplémentaire par rapport à celui de la GLib
*
* Copyright (C) 2014-2017 Cyrille Bagard
*