obj_lock function <BLOC/object.h>

The obj_lock function locks an object to ensure only one thread can operate on it at a time. It can only guarantee serialised access if the code to deal with the object always attempts to lock it first. This must be coupled with a call to obj_unlock. If an object that is already locked is locked by the same thread, the call will succeed without waiting. An object must be unlocked an equal number of times to being locked.

Syntax

void
obj_lock(
	void *addr
);

Parameters

addr

The address of the object to be locked. This must be a pointer to an object created by the library or the call will cause the program to terminate.