logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Resource - shared object

Bugs

       This scheme relies on manual referencing, which is more efficient, but also more dangerous.

       When garbage collection is supported by the runtime system, resources will be unnecessary.

InterViews Reference Manual                                                                         Resource(3I)

Description

Resource is a class that provides a simple form of reference counting for shared objects.  Every resource
       has  a reference count that is initially set to zero and must be explicitly incremented through a call to
       Reference.  A resource should not be deleted like other objects;  instead,  the  static  member  function
       unref should be used to unreference the object.

       When  a  resource  is unreferenced, the reference count is decremented unless it is already zero.  If the
       count is zero, the object is destroyed.

Friend Operations

voidUnref(Resource*)
              This function is equivalent to static unref and is provided solely for backward compatibility.  It
              will be removed in a future version.

Name

       Resource - shared object

Public Operations

Resource()
              Create a new resource object with its reference count set to zero.

       voidref()
              Increment the resource's reference count.

       voidunref()
              Decrement the resource's reference count, if it is positive, and delete this if the count is zero.

       staticvoidref(Resource*)
              If the resource is not nil, call ref on it.  Otherwise do nothing.

       staticvoidunref(Resource*)
              If the resource is not nil, call unref on it.  Otherwise do nothing.

       voidReference()
              This function is equivalent to ref and is provided solely for backward compatibility.  It will  be
              removed in a future version.

       voidUnreference()
              This  function  is equivalent to unref and is provided solely for backward compatibility.  It will
              be removed in a future version.

Synopsis

#include<InterViews/resource.h>

See Also