Public Types | Static Public Member Functions

Tiny2D::Jobs Class Reference

Asynchronous job system. More...

#include <Tiny2D.h>

List of all members.

Public Types

typedef int JobID
 Unique job identifier.
typedef void(* JobFunc )(void *userData)
 Job function (performed on non-main thread)
typedef void(* DoneFunc )(bool canceled, void *userData)
 Job done function (performed on main thread); canceled set to true indicates that job was canceled and its job function was not performed.

Static Public Member Functions

static JobID RunJob (JobFunc jobFunc, DoneFunc doneFunc, void *userData)
 Runs asynchronous job function; when done invokes supplied (optional) done function on main thread; returns unique job id.
static int GetNumJobsInProgress ()
 Gets number of jobs still in progress.
static void UpdateDoneJobs (float maxUpdateTime=1.0f/120.0f)
 Updates jobs that require main thread update.
static void WaitForJob (JobID id)
 Waits for a particular job to complete.
static void CancelJob (JobID id)
 Cancels particular job.
static void WaitForAllJobs ()
 Waits for all jobs to complete.

Detailed Description

Asynchronous job system.


Member Typedef Documentation

typedef void(* Tiny2D::Jobs::DoneFunc)(bool canceled, void *userData)

Job done function (performed on main thread); canceled set to true indicates that job was canceled and its job function was not performed.

typedef void(* Tiny2D::Jobs::JobFunc)(void *userData)

Job function (performed on non-main thread)

typedef int Tiny2D::Jobs::JobID

Unique job identifier.


Member Function Documentation

static void Tiny2D::Jobs::CancelJob ( JobID  id ) [static]

Cancels particular job.

static int Tiny2D::Jobs::GetNumJobsInProgress (  ) [static]

Gets number of jobs still in progress.

static JobID Tiny2D::Jobs::RunJob ( JobFunc  jobFunc,
DoneFunc  doneFunc,
void *  userData 
) [static]

Runs asynchronous job function; when done invokes supplied (optional) done function on main thread; returns unique job id.

static void Tiny2D::Jobs::UpdateDoneJobs ( float  maxUpdateTime = 1.0f/120.0f ) [static]

Updates jobs that require main thread update.

static void Tiny2D::Jobs::WaitForAllJobs (  ) [static]

Waits for all jobs to complete.

static void Tiny2D::Jobs::WaitForJob ( JobID  id ) [static]

Waits for a particular job to complete.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines