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),
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 removeDepdenency(Operation *self, Operation *dependency)
static void initialize(Class *clazz)
An abstraction for discrete units of work, or tasks.
void(* OperationFunction)(Operation *operation)
The function type for Operation execution.
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.
ssize_t indexOfObject(const Array *self, const ident obj)
ident objectAtIndex(const Array *self, int index)
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.
void wait(Condition *self)
Waits indefinitely for this Condition to be signaled.
Condition * init(Condition *self)
Initializes this Condition.
void broadcast(Condition *self)
Signals all Threads waiting on this Condition.
void addObject(MutableArray *self, const ident obj)
Adds the specified Object to this MutableArray.
void removeObject(MutableArray *self, const ident obj)
Removes the specified Object from this MutableArray.
MutableData * data(void)
Returns a new MutableData.
Object is the root Class of The Objectively Class hierarchy.
Class * _Object(void)
The Object archetype.
Object * init(Object *self)
Initializes this Object.
Object * copy(const Object *self)
Creates a shallow copy of this Object.
void dealloc(Object *self)
Frees all resources held by this Object.
An abstraction for discrete units of work, or tasks.
Condition * condition
The Condition enabling waitUntilFinished.
_Bool isReady(const Operation *self)
void start(Operation *self)
Starts this Operation.
_Bool isCancelled
true when this Operation has been cancelled, false otherwise.
OperationFunction function
The Operation function.
void cancel(Operation *self)
Cancels this Operation, allowing it to complete immediately.
MutableArray * dependencies
Contains Operations which must finish before this one can start.
Operation * initWithFunction(Operation *self, OperationFunction function, ident data)
Initializes a synchronous Operation with the given function.
Class * _Operation(void)
The Operation archetype.
Array * dependencies(const Operation *self)
_Bool isExecuting
true when this Operation is executing, false otherwise.
void addDependency(Operation *self, Operation *dependency)
Makes this Operation dependent on the completion of dependency.
_Bool isFinished
true when this Operation is finished, false otherwise.
void waitUntilFinished(const Operation *self)
Blocks the current thread until this Operation isFinished.
OperationQueues provide a thread of execution for Operations.
OperationQueue * currentQueue(void)
void removeOperation(OperationQueue *self, Operation *operation)
Removes the Operation from this queue.