aboutsummaryrefslogtreecommitdiff
path: root/libports/lookup-port.c
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-05-03 01:02:35 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-10-05 23:31:08 +0200
commit78343e97c68fda079c66f2443bab6d1ee16f0b67 (patch)
treec2293ad70042bf6d839ab6ef5436e4c9fdf2cdcc /libports/lookup-port.c
parent9a043bf1792be16a045dd2e2e37c2c6354425b9b (diff)
downloadhurd-78343e97c68fda079c66f2443bab6d1ee16f0b67.tar.gz
hurd-78343e97c68fda079c66f2443bab6d1ee16f0b67.tar.bz2
hurd-78343e97c68fda079c66f2443bab6d1ee16f0b67.zip
libports: lock-less reference counting for port_info objects
* libports/ports.h (struct port_info): Use the new type. * libports/lookup-port.c: No need to lock _ports_lock anymore. * libports/bucket-iterate.c: Likewise. * libports/complete-deallocate.c: Check if someone reacquired a reference through a hash table lookup. * libports/create-internal.c: Use the new reference counting primitives. * libports/get-right.c: Likewise. * libports/import-port.c: Likewise. * libports/port-deref-weak.c: Likewise. * libports/port-deref.c: Likewise. * libports/port-ref-weak.c: Likewise. * libports/port-ref.c: Likewise. * libports/reallocate-from-external.c: Likewise. * libports/transfer-right.c: Likewise. * utils/rpctrace.c: Likewise.
Diffstat (limited to 'libports/lookup-port.c')
-rw-r--r--libports/lookup-port.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/libports/lookup-port.c b/libports/lookup-port.c
index 858ee112..2f0eee9d 100644
--- a/libports/lookup-port.c
+++ b/libports/lookup-port.c
@@ -28,7 +28,6 @@ ports_lookup_port (struct port_bucket *bucket,
{
struct port_info *pi;
- pthread_mutex_lock (&_ports_lock);
pthread_rwlock_rdlock (&_ports_htable_lock);
pi = hurd_ihash_find (&_ports_htable, port);
@@ -38,10 +37,9 @@ ports_lookup_port (struct port_bucket *bucket,
pi = 0;
if (pi)
- pi->refcnt++;
+ refcounts_unsafe_ref (&pi->refcounts, NULL);
pthread_rwlock_unlock (&_ports_htable_lock);
- pthread_mutex_unlock (&_ports_lock);
return pi;
}