28#define _Class _Operation
53#pragma mark - Operation
62 assert(dependency != self);
66 $(self->dependencies,
addObject, dependency);
79 __atomic_store_n(&self->isCancelled,
true, __ATOMIC_RELEASE);
84 synchronized(queue->condition, {
85 $(queue->condition, signal);
112 assert(self->condition);
115 assert(self->dependencies);
127 self = $(self,
init);
141 return __atomic_load_n(&self->isCancelled, __ATOMIC_ACQUIRE);
199 synchronized(self->condition, {
210 synchronized(self->condition, {
212 $(self->condition, wait);
217#pragma mark - Class lifecycle
252 .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 bool isCancelled(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 isFinished
true when this Operation is finished, false otherwise.
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.
bool isExecuting
true when this Operation is executing, false otherwise.
OperationQueues provide threads of execution for Operations.