diff options
author | Tavian Barnes <tavianator@gmail.com> | 2010-06-28 15:57:54 -0600 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2010-06-28 16:01:12 -0600 |
commit | eb4691098767935c1ffd10f7da46796c11eefcfa (patch) | |
tree | cb52c739182961869efc5b41bce68a97f9731807 /libdimension/scene.c | |
parent | 1b77e953067ce43515e96f99ecafa2ea468a60bc (diff) | |
download | dimension-eb4691098767935c1ffd10f7da46796c11eefcfa.tar.xz |
Use sched_getaffinity() rather than sysconf(_SC_NPROCESSORS_ONLN).
Also, abstract cpu counting into dedicated dmnsn_ncpus() function.
Diffstat (limited to 'libdimension/scene.c')
-rw-r--r-- | libdimension/scene.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/libdimension/scene.c b/libdimension/scene.c index 10af1b2..c81f936 100644 --- a/libdimension/scene.c +++ b/libdimension/scene.c @@ -18,9 +18,8 @@ * <http://www.gnu.org/licenses/>. * *************************************************************************/ -#include "dimension.h" +#include "dimension_impl.h" #include <stdlib.h> -#include <unistd.h> /* For sysconf */ /* Allocate an empty scene */ dmnsn_scene * @@ -35,12 +34,7 @@ dmnsn_new_scene() scene->lights = dmnsn_new_array(sizeof(dmnsn_light *)); scene->quality = DMNSN_RENDER_FULL; scene->reclimit = 5; - - /* Find the number of processors/cores running (TODO: do this portably) */ - int nprocs = sysconf(_SC_NPROCESSORS_ONLN); - if (nprocs < 1) - nprocs = 1; - scene->nthreads = nprocs; + scene->nthreads = dmnsn_ncpus(); return scene; } |