[gimp] libgimp: add gimp_get_num_processors().
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimp: add gimp_get_num_processors().
- Date: Fri, 11 Dec 2020 17:24:57 +0000 (UTC)
commit 698b7184b22017a24fe7fa2032edf5fa35cb9615
Author: Jehan <jehan girinstud io>
Date: Fri Dec 11 18:24:36 2020 +0100
libgimp: add gimp_get_num_processors().
libgimp/gimp.c | 19 +++++++++++++++++++
libgimp/gimp.def | 1 +
libgimp/gimp.h | 1 +
3 files changed, 21 insertions(+)
---
diff --git a/libgimp/gimp.c b/libgimp/gimp.c
index e964e263e5..25500c72d0 100644
--- a/libgimp/gimp.c
+++ b/libgimp/gimp.c
@@ -145,6 +145,7 @@ static gboolean _export_comment = FALSE;
static gboolean _export_exif = FALSE;
static gboolean _export_xmp = FALSE;
static gboolean _export_iptc = FALSE;
+static gint32 _num_processors = 1;
static GimpCheckSize _check_size = GIMP_CHECK_SIZE_MEDIUM_CHECKS;
static GimpCheckType _check_type = GIMP_CHECK_TYPE_GRAY_CHECKS;
static gint _default_display_id = -1;
@@ -782,6 +783,23 @@ gimp_export_iptc (void)
return _export_iptc;
}
+/**
+ * gimp_get_num_processors:
+ *
+ * Returns the number of threads set explicitly by the user in the
+ * preferences. This information can be used by plug-ins wishing to
+ * follow user settings for multi-threaded implementations.
+ *
+ * Returns: the prefered number of threads to use.
+ *
+ * Since: 3.0
+ **/
+gint32
+gimp_get_num_processors (void)
+{
+ return _num_processors;
+}
+
/**
* gimp_check_size:
*
@@ -1132,6 +1150,7 @@ _gimp_config (GPConfig *config)
_export_xmp = config->export_xmp ? TRUE : FALSE;
_export_iptc = config->export_iptc ? TRUE : FALSE;
_export_comment = config->export_comment;
+ _num_processors = config->num_processors;
_default_display_id = config->default_display_id;
_wm_class = g_strdup (config->wm_class);
_display_name = g_strdup (config->display_name);
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
index 32fa15e3bb..b999ba9f34 100644
--- a/libgimp/gimp.def
+++ b/libgimp/gimp.def
@@ -294,6 +294,7 @@ EXPORTS
gimp_get_images
gimp_get_module_load_inhibit
gimp_get_monitor_resolution
+ gimp_get_num_processors
gimp_get_parasite
gimp_get_parasite_list
gimp_get_pdb
diff --git a/libgimp/gimp.h b/libgimp/gimp.h
index 71649bd026..9686719875 100644
--- a/libgimp/gimp.h
+++ b/libgimp/gimp.h
@@ -178,6 +178,7 @@ gboolean gimp_export_comment (void) G_GNUC_CONST;
gboolean gimp_export_exif (void) G_GNUC_CONST;
gboolean gimp_export_xmp (void) G_GNUC_CONST;
gboolean gimp_export_iptc (void) G_GNUC_CONST;
+gint gimp_get_num_processors (void) G_GNUC_CONST;
GimpCheckSize gimp_check_size (void) G_GNUC_CONST;
GimpCheckType gimp_check_type (void) G_GNUC_CONST;
GimpDisplay * gimp_default_display (void) G_GNUC_CONST;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]