mirror of https://github.com/GNOME/gimp.git
Revert "pdb: Added a procedure to check how many processors GIMP is configured to use."
This reverts commit b22880c32f
.
Adding this procedure was a misunderstanding on IRC.
This commit is contained in:
parent
b22880c32f
commit
d303d8c7c1
|
@ -29,7 +29,6 @@
|
|||
|
||||
#include "pdb-types.h"
|
||||
|
||||
#include "base/pixel-processor.h"
|
||||
#include "config/gimprc.h"
|
||||
#include "core/gimp-utils.h"
|
||||
#include "core/gimp.h"
|
||||
|
@ -227,33 +226,6 @@ get_module_load_inhibit_invoker (GimpProcedure *procedure,
|
|||
return return_vals;
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
get_number_of_processors_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GValueArray *args,
|
||||
GError **error)
|
||||
{
|
||||
GValueArray *return_vals;
|
||||
gint32 num_proc = 0;
|
||||
|
||||
gchar *str;
|
||||
|
||||
str = gimp_rc_query (GIMP_RC (gimp->config), "num-processors");
|
||||
num_proc = (gint32) g_ascii_strtoll (str, NULL, 0);
|
||||
|
||||
/* Although this is probably not necessary, still be safe */
|
||||
num_proc = CLAMP (num_proc, 1, GIMP_MAX_NUM_THREADS);
|
||||
|
||||
g_free (str);
|
||||
|
||||
return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
|
||||
g_value_set_int (&return_vals->values[1], num_proc);
|
||||
|
||||
return return_vals;
|
||||
}
|
||||
|
||||
void
|
||||
register_gimprc_procs (GimpPDB *pdb)
|
||||
{
|
||||
|
@ -470,27 +442,4 @@ register_gimprc_procs (GimpPDB *pdb)
|
|||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-get-number-of-processors
|
||||
*/
|
||||
procedure = gimp_procedure_new (get_number_of_processors_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
"gimp-get-number-of-processors");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-get-number-of-processors",
|
||||
"Get the number of processors which GIMP was configured to use.",
|
||||
"Returns the number of processors which GIMP was configured to use. This value is taken from the Preferences and there's no guarantee for the value to be reasonable. This function is mainly intended for plugin writers who want to write multithreaded plugins and need to know how many threads to create.",
|
||||
"Barak Itkin <lightningismyname@gmail.com>",
|
||||
"Barak Itkin",
|
||||
"2010",
|
||||
NULL);
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
gimp_param_spec_int32 ("num-proc",
|
||||
"num proc",
|
||||
"The number of processors",
|
||||
1, GIMP_MAX_NUM_THREADS, 1,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "internal-procs.h"
|
||||
|
||||
|
||||
/* 603 procedures registered total */
|
||||
/* 602 procedures registered total */
|
||||
|
||||
void
|
||||
internal_procs_init (GimpPDB *pdb)
|
||||
|
|
|
@ -294,37 +294,3 @@ gimp_get_module_load_inhibit (void)
|
|||
|
||||
return load_inhibit;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_get_number_of_processors:
|
||||
*
|
||||
* Get the number of processors which GIMP was configured to use.
|
||||
*
|
||||
* Returns the number of processors which GIMP was configured to use.
|
||||
* This value is taken from the Preferences and there's no guarantee
|
||||
* for the value to be reasonable. This function is mainly intended for
|
||||
* plugin writers who want to write multithreaded plugins and need to
|
||||
* know how many threads to create.
|
||||
*
|
||||
* Returns: The number of processors.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
*/
|
||||
gint
|
||||
gimp_get_number_of_processors (void)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gint num_proc = 0;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-get-number-of-processors",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
num_proc = return_vals[1].data.d_int32;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return num_proc;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ gboolean gimp_get_monitor_resolution (gdouble *xres,
|
|||
gchar* gimp_get_theme_dir (void);
|
||||
G_GNUC_INTERNAL gchar* _gimp_get_color_configuration (void);
|
||||
gchar* gimp_get_module_load_inhibit (void);
|
||||
gint gimp_get_number_of_processors (void);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -233,45 +233,8 @@ CODE
|
|||
);
|
||||
}
|
||||
|
||||
sub get_number_of_processors {
|
||||
$blurb = 'Get the number of processors which GIMP was configured to use.';
|
||||
$help = <<'HELP';
|
||||
Returns the number of processors which GIMP was configured to use. This value
|
||||
is taken from the Preferences and there's no guarantee for the value to be
|
||||
reasonable. This function is mainly intended for plugin writers who want to
|
||||
write multithreaded plugins and need to know how many threads to create.
|
||||
HELP
|
||||
|
||||
$author = 'Barak Itkin <lightningismyname@gmail.com>';
|
||||
$copyright = 'Barak Itkin';
|
||||
$date = '2010';
|
||||
$since = '2.8';
|
||||
|
||||
@outargs = (
|
||||
{ name => 'num_proc', type => '1 <= int32 <= GIMP_MAX_NUM_THREADS',
|
||||
desc => 'The number of processors' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
gchar *str;
|
||||
|
||||
str = gimp_rc_query (GIMP_RC (gimp->config), "num-processors");
|
||||
num_proc = (gint32) g_ascii_strtoll (str, NULL, 0);
|
||||
|
||||
/* Although this is probably not necessary, still be safe */
|
||||
num_proc = CLAMP (num_proc, 1, GIMP_MAX_NUM_THREADS);
|
||||
|
||||
g_free (str);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@headers = qw(<string.h>
|
||||
"base/pixel-processor.h"
|
||||
"config/gimprc.h"
|
||||
"core/gimp.h");
|
||||
|
||||
|
@ -282,8 +245,7 @@ CODE
|
|||
get_monitor_resolution
|
||||
get_theme_dir
|
||||
get_color_configuration
|
||||
get_module_load_inhibit
|
||||
get_number_of_processors);
|
||||
get_module_load_inhibit);
|
||||
|
||||
%exports = (app => [@procs], lib => [@procs]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue