diff options
author | rsc <devnull@localhost> | 2003-12-17 04:34:52 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2003-12-17 04:34:52 +0000 |
commit | 49588d5d9089589ccda28c41aae90c29d6f72787 (patch) | |
tree | 48cbc911e34b71977b7b98b4d0b94b27d4454081 /src/libthread/ref.c | |
parent | 7f11104a5737adf261d10bc1a7b85e740f2eb491 (diff) | |
download | plan9port-49588d5d9089589ccda28c41aae90c29d6f72787.tar.gz plan9port-49588d5d9089589ccda28c41aae90c29d6f72787.tar.bz2 plan9port-49588d5d9089589ccda28c41aae90c29d6f72787.zip |
Tweaks to various bits.
Until I hear otherwise, Refs aren't used enough to
merit their own assembly. They are now implemented with locks.
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; } |