blob: a3b2cbae53acefe2830c7680aaa145e9562249cb [file] [log] [blame]
/*
* Atomic reference counts - used by applications.
*
* We use locks to avoid the assembly of the Plan 9 versions.
*/
#include "threadimpl.h"
void
incref(Ref *r)
{
lock(&r->lk);
r->ref++;
unlock(&r->lk);
}
long
decref(Ref *r)
{
long n;
lock(&r->lk);
n = --r->ref;
unlock(&r->lk);
return n;
}