/* $Id: tbb_demos.cpp 1135 2006-09-06 07:53:02Z olau $ */

/* Copyright (C) 2006 Oliver Lau <ola@ctmagazin.de>, Heise Zeitschriften Verlag */

#include <cstdlib>
#include <ctype.h>

#include "tbb/task_scheduler_init.h"

#include "tbb_demos.h"

int getNumTBBThreads(void) 
{
  char *TBB_NUM_THREADS = getenv("TBB_NUM_THREADS");

  int numThreads = tbb::task_scheduler_init::automatic;

  if (TBB_NUM_THREADS != NULL && isdigit(TBB_NUM_THREADS[0]))
    numThreads = atoi(TBB_NUM_THREADS);

  if (numThreads == 0)
    numThreads = tbb::task_scheduler_init::automatic;

  return numThreads;
}
