#include "stdafx.h"
#include "parallel.h"
#include "memory.h"
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/sysctl.h>
#include <errno.h>
#include <list>
Go to the source code of this file.
Functions | |
static void * | taskEntry (void *arg) |
void | TasksInit () |
void | TasksCleanup () |
void | EnqueueTasks (const vector< Task * > &tasks) |
void | WaitForAllTasks () |
int | NumSystemCores () |
Variables | |
static pthread_t * | threads |
static Mutex * | taskQueueMutex = Mutex::Create() |
static std::vector< Task * > | taskQueue |
static Semaphore * | workerSemaphore |
static uint32_t | numUnfinishedTasks |
static ConditionVariable * | tasksRunningCondition |
void EnqueueTasks | ( | const vector< Task * > & | tasks | ) |
Definition at line 789 of file parallel.cpp.
References ConditionVariable::Lock(), Options::nCores, numUnfinishedTasks, PbrtOptions, Semaphore::Post(), taskQueue, TasksInit(), threads, and ConditionVariable::Unlock().
Referenced by PhotonIntegrator::Preprocess(), IrradianceCacheIntegrator::Preprocess(), SurfacePointsRenderer::Render(), SamplerRenderer::Render(), MetropolisRenderer::Render(), and CreateRadianceProbes::Render().
int NumSystemCores | ( | ) |
Definition at line 867 of file parallel.cpp.
References Assert, Error(), Options::nCores, and PbrtOptions.
Referenced by main(), PhotonIntegrator::Preprocess(), SurfacePointsRenderer::Render(), SamplerRenderer::Render(), MetropolisRenderer::Render(), TasksCleanup(), and TasksInit().
static void * taskEntry | ( | void * | arg | ) | [static] |
Definition at line 819 of file parallel.cpp.
References ConditionVariable::Lock(), numUnfinishedTasks, Task::Run(), ConditionVariable::Signal(), taskQueue, ConditionVariable::Unlock(), and Semaphore::Wait().
Referenced by TasksInit().
void TasksCleanup | ( | ) |
Definition at line 742 of file parallel.cpp.
References Assert, Options::nCores, NumSystemCores(), PbrtOptions, Semaphore::Post(), Severe(), taskQueue, and threads.
Referenced by pbrtWorldEnd().
void TasksInit | ( | ) |
Definition at line 714 of file parallel.cpp.
References Options::nCores, NumSystemCores(), PbrtOptions, Severe(), taskEntry(), and threads.
Referenced by EnqueueTasks().
void WaitForAllTasks | ( | ) |
Definition at line 851 of file parallel.cpp.
References ConditionVariable::Lock(), Options::nCores, numUnfinishedTasks, PbrtOptions, ConditionVariable::Unlock(), and ConditionVariable::Wait().
Referenced by PhotonIntegrator::Preprocess(), IrradianceCacheIntegrator::Preprocess(), SurfacePointsRenderer::Render(), SamplerRenderer::Render(), MetropolisRenderer::Render(), and CreateRadianceProbes::Render().
uint32_t numUnfinishedTasks [static] |
Definition at line 58 of file parallel.cpp.
Referenced by EnqueueTasks(), taskEntry(), and WaitForAllTasks().
Definition at line 54 of file parallel.cpp.
Referenced by EnqueueTasks(), taskEntry(), and TasksCleanup().
Mutex* taskQueueMutex = Mutex::Create() [static] |
Definition at line 53 of file parallel.cpp.
ConditionVariable* tasksRunningCondition [static] |
Definition at line 59 of file parallel.cpp.
pthread_t* threads [static] |
Definition at line 47 of file parallel.cpp.
Referenced by EnqueueTasks(), TasksCleanup(), and TasksInit().
Semaphore* workerSemaphore [static] |
Definition at line 57 of file parallel.cpp.