29#define _Class _Operation
48 release(this->locals.condition);
49 release(this->locals.dependencies);
54#pragma mark - Operation
63 assert(dependency != self);
121 self = $(self,
init);
208#pragma mark - Class lifecycle
242 .interfaceOffset = offsetof(
Operation, interface),
243 .interfaceSize =
sizeof(OperationInterface),
static ident objectAtIndex(const Array *self, size_t index)
static void removeObject(Array *self, const ident obj)
static void addObject(Array *self, const ident obj)
static ssize_t indexOfObject(const Array *self, const ident obj)
ident release(ident obj)
Atomically decrement the given Object's reference count. If the resulting reference count is 0,...
Class * _initialize(const ClassDef *def)
Initializes the given Class.
#define alloc(type)
Allocate and initialize and instance of type.
#define super(type, obj, method,...)
static void broadcast(Condition *self)
static Array * dependencies(const Operation *self)
static void removeDepdenency(Operation *self, Operation *dependency)
static void waitUntilFinished(const Operation *self)
static Operation * initWithFunction(Operation *self, OperationFunction function, ident data)
static void start(Operation *self)
static void dealloc(Object *self)
static Operation * init(Operation *self)
static Object * copy(const Object *self)
static void initialize(Class *clazz)
static void cancel(Operation *self)
static void addDependency(Operation *self, Operation *dependency)
static bool isReady(const Operation *self)
An abstraction for discrete units of work, or tasks.
void(* OperationFunction)(Operation *operation)
The function type for Operation execution.
static void removeOperation(OperationQueue *self, Operation *operation)
static OperationQueue * currentQueue(void)
OperationQueues provide a thread of execution for Operations.
void * ident
The identity type, similar to Objective-C id.
#define do_once(once, block)
Executes the given block at most one time.
Array * init(Array *self)
Initializes this Array.
size_t count
The count of elements.
ClassDefs are passed to _initialize via an archetype to initialize a Class.
The runtime representation of a Class.
ident interface
The interface of the Class.
POSIX Threads conditional variables.
Object is the root Class of The Objectively Class hierarchy.
void dealloc(Object *self)
Frees all resources held by this Object.
An abstraction for discrete units of work, or tasks.
bool isCancelled
true when this Operation has been cancelled, false otherwise.
bool isFinished
true when this Operation is finished, false otherwise.
Condition * condition
The Condition enabling waitUntilFinished.
OperationFunction function
The Operation function.
Operation * initWithFunction(Operation *self, OperationFunction function, ident data)
Initializes a synchronous Operation with the given function.
Array * dependencies
Contains Operations which must finish before this one can start.
bool isReady(const Operation *self)
bool isExecuting
true when this Operation is executing, false otherwise.
OperationQueues provide a thread of execution for Operations.