Gaffer Docs


The Process base class encapsulates the base unit of operation within Gaffer. Clients of the library implement subclasses of Process with update method overrides that do work.

Process Class

enum eProcessStatus

class EventMgr;

class Process
      : status_(eProcessStatus_Running)

    eProcessStatus status() { return status_; }
    void setStatus(eProcessStatus status) { status_ = status; }

    virtual void update(int delta) = 0;

    virtual ~Process() {}

    eProcessStatus status_;


Factor Aggressively into Simple Processes

Clients must remember that the update method must return quickly. Processes should encapsulate as small a unit of work as possible. Processes with excessive update methods will degrade system performance as there is no pre-emption once update has been called. In the primary ProcessMgr (the one responsible for rendering) all Processes must update before each frame is rendered, so your frame rate is directly dependent on how quickly all processes execute.

The Gaffer runtime is designed specifically for small Processes such as these. You can create hundreds of thousands of them and still get reasonable performance on a multicore system. So, strive to create simple Processes that do specific jobs and update quickly.

Process Status

The enum eProcessStatus defines three states. These include:

Ending a Process

For a process to quit, it should set its status to Completed. It will be cleaned up during the next iteration of the game loop. Clients must never explicitly delete a process.