Commit fab5330d authored by Tor Lillqvist's avatar Tor Lillqvist Committed by Tor Lillqvist

app/base/base-utils.c New files, with just one function so far,

2007-11-01  Tor Lillqvist  <tml@novell.com>

	* app/base/base-utils.c
	* app/base/base-utils.h: New files, with just one function so far,
	get_number_of_processors(). Include implementation also for Win32.

	* app/base/Makefile.am (libappbase_a_SOURCES): Add new files.

	* app/config/gimpbaseconfig.c (gimp_base_config_class_init): Use
	get_number_of_processors().


svn path=/trunk/; revision=24028
parent 07ab51f8
2007-11-01 Tor Lillqvist <tml@novell.com>
* app/base/base-utils.c
* app/base/base-utils.h: New files, with just one function so far,
get_number_of_processors(). Include implementation also for Win32.
* app/base/Makefile.am (libappbase_a_SOURCES): Add new files.
* app/config/gimpbaseconfig.c (gimp_base_config_class_init): Use
get_number_of_processors().
2007-11-01 Manish Singh <yosh@gimp.org>
* app/core/gimpcontainer-filter.c
......
......@@ -8,6 +8,8 @@ libappbase_a_SOURCES = \
base-enums.c \
base-enums.h \
base-types.h \
base-utils.c \
base-utils.h \
boundary.c \
boundary.h \
color-balance.c \
......
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <glib.h>
#ifdef G_OS_WIN32
#include <windows.h>
#endif
#include "base-utils.h"
#define NUM_PROCESSORS_DEFAULT 1
/* public functions */
gint
get_number_of_processors (void)
{
gint retval = NUM_PROCESSORS_DEFAULT;
#ifdef G_OS_UNIX
#if defined(HAVE_UNISTD_H) && defined(_SC_NPROCESSORS_ONLN)
retval = sysconf (_SC_NPROCESSORS_ONLN);
#endif
#endif
#ifdef G_OS_WIN32
SYSTEM_INFO system_info;
GetSystemInfo (&system_info);
retval = system_info.dwNumberOfProcessors;
#endif
return retval;
}
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __BASE_H__
#define __BASE_H__
gint get_number_of_processors (void);
#endif /* __BASE_H__ */
......@@ -32,6 +32,7 @@
#include "config-types.h"
#include "base/base-utils.h"
#include "base/pixel-processor.h"
#include "gimprc-blurbs.h"
......@@ -39,8 +40,6 @@
#include "gimp-intl.h"
#define NUM_PROCESSORS_DEFAULT 1
enum
{
......@@ -94,11 +93,7 @@ gimp_base_config_class_init (GimpBaseConfigClass *klass)
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART);
#if defined(HAVE_UNISTD_H) && defined(_SC_NPROCESSORS_ONLN)
num_processors = sysconf (_SC_NPROCESSORS_ONLN);
#else
num_processors = NUM_PROCESSORS_DEFAULT;
#endif
num_processors = get_number_of_processors ();
#ifdef GIMP_UNSTABLE
num_processors = num_processors * 2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment