int decref(Ref *r)
typedef struct struct Ref { Lock; long ref; } Ref;
The reference count proper is found in ref; the Lock prevents concurrent updates (see lock(10.2)).
Incref atomically increments the reference count r, and returns the new count.
Decref atomically decrements the reference count r, and returns the new count.
if(decref(s) == 0) free(s);
REF(10.2 ) | Rev: Thu Feb 15 14:42:59 GMT 2007 |