50 pthread_mutex_destroy(this->
lock);
67 self->lock = calloc(1,
sizeof(pthread_mutex_t));
70 const int err = pthread_mutex_init(self->lock, NULL);
83 int err = pthread_mutex_lock(self->lock);
93 int err = pthread_mutex_trylock(self->lock);
94 assert(err == 0 || err == EBUSY);
105 int err = pthread_mutex_unlock(self->lock);
109#pragma mark - Class lifecycle
137 .instanceSize =
sizeof(
Lock),
138 .interfaceOffset = offsetof(
Lock, interface),
139 .interfaceSize =
sizeof(LockInterface),
Class * _initialize(const ClassDef *def)
Initializes the given Class.
#define super(type, obj, method,...)
static void unlock(Lock *self)
static Lock * init(Lock *self)
static void lock(Lock *self)
static void dealloc(Object *self)
static bool tryLock(Lock *self)
static Object * copy(const Object *self)
static void initialize(Class *clazz)
#define do_once(once, block)
Executes the given block at most one time.
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.
Object is the root Class of The Objectively Class hierarchy.
void dealloc(Object *self)
Frees all resources held by this Object.