diff options
Diffstat (limited to 'src/libthread/ref.c')
-rw-r--r-- | src/libthread/ref.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libthread/ref.c b/src/libthread/ref.c index 9b78e63e..8f50fd5f 100644 --- a/src/libthread/ref.c +++ b/src/libthread/ref.c @@ -3,11 +3,18 @@ void incref(Ref *r) { - _xinc(&r->ref); + lock(&r->lk); + r->ref++; + unlock(&r->lk); } long decref(Ref *r) { - return _xdec(&r->ref); + long n; + + lock(&r->lk); + n = --r->ref; + unlock(&r->lk); + return n; } |