MX_ATOM
Base class for reference counting and delete locking
MX_ATOM is an object intended to be used as a base class to implement reference counting and delete locking in the derived class.
Properly constructed MX_ATOM objects are bit-copy-correct which means that a binary copy retains proper functioning. The copied object should not be used after the binary copy.
Because MX_ATOM is bit-copy-correct it can safely be placed in a MX_VECTOR
or the memory realloc'd.
(../include/deds/atom.h)
(library deds : module atom)
# define mx_atom(a,d,s)
Construct an MX_ATOM
This macro constructs a MX_ATOM which is a base object for reference counting.
(../include/deds/atom.h)
(library deds : module atom)
# define mx_delete(a)
Destroy an MX_ATOM
This macro causes an object to be marked for destruction. If no locks (MX_LOCK)
or references (MX_REF) exist for this object then the object is destroyed and
if appropitae the memory is released.
(../include/deds/atom.h)
(library deds : module atom)
# define mx_locked(a)
Find out if an object is locked or not
(../include/deds/atom.h)
(library deds : module atom)
MX_LOCK
Stop MX_ATOMs from getting deleted
This object implements a delete lock for an MX_ATOM. While a valid MX_LOCK exists for an MX_ATOM object (or one derived from it) the object is guaranteed not be deleted. An object can have multiple locks placed on it.
MX_LOCK is NOT bit-copy-correct so it cannot safely be placed in a MX_VECTOR
or in memory that gets realloc'd.
(../include/deds/atom.h)
(library deds : module atom)
# define mx_lock(l,a)
Construct a MX_LOCK
This macro creates a lock for an object derived from MX_ATOM. The locked
MX_ATOM is guaranteed not to be deleted while a valid lock exists.
(../include/deds/atom.h)
(library deds : module atom)
unsigned mx_unlock(MX_LOCK* lock)
Destruct a MX_LOCK
This function destroys a MX_LOCK and removes it from it's associated MX_ATOM object. If the object has been flagged for deletion (with the mx_delete() macro) then removal of the last lock caused the MX_ATOM destructor to be called and (if necessary) memory returned to the operating system.
If the release of the lock triggered calling of the object destructor then the function returns non-zero. If this occurs then it is not safe to access the object anymore. If this function returns false then either:
unsigned mx_lastlock(const MX_LOCK* lock)
Find out if a lock is the last one of an object
(../include/deds/atom.h)
(library deds : module atom)
# define MX_REF(type)
A reference type, a typed MX_LOCK
This macro defines a MX_LOCK where the target is of some defined type.
A reference functions the same way as a MX_LOCK except the locked (i.e. referenced)
object is available in a typesafe way. A pointer to the reference target is
available with the MXREF macro.
(../include/deds/atom.h)
(library deds : module atom)
# define mx_ref(r,t)
Construct a MX_REF
The macro constructs a MX_REF to an object.
(../include/deds/atom.h)
(library deds : module atom)
# define mx_unref(r)
Destruct a MX_REF
The macro destroys a MX_REF to an object. The object may
be deleted in the dereference, see the mx_unlock() macro.
(../include/deds/atom.h)
(library deds : module atom)
# define MXREF(r)
Return the object behind a MX_REF
Return the object behind the MX_REF to an object.
(../include/deds/atom.h)
(library deds : module atom)
Generated by MXDOC 2.2 on Sun Feb 4 15:16:26 2007