aboutsummaryrefslogtreecommitdiff
path: root/src/libthread/ref.c
blob: 8f50fd5fea8845646d70b613443e3fcef89cf404 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#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;
}