28#define _Class _Operation
47 release(this->locals.condition);
48 release(this->locals.dependencies);
53#pragma mark - Operation
62 assert(dependency != self);
127 self = $(self,
init);
209#pragma mark - Class lifecycle
243 .interfaceOffset = offsetof(
Operation, interface),
244 .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)
void(* OperationFunction)(Operation *operation)
The function type for Operation execution.
OperationQueues provide threads 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.
bool isDispatched
True once an OperationQueue has dispatched this Operation to one of its Threads, so that no other Thr...
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)
OperationQueue * queue
The OperationQueue this Operation was added to, if any.
bool isExecuting
true when this Operation is executing, false otherwise.
OperationQueues provide threads of execution for Operations.
Condition * condition
A condition signaled on addOperation and removeOperation.