PERFORCE change 103163 for review

Roman Divacky rdivacky at FreeBSD.org
Fri Aug 4 13:07:29 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=103163

Change 103163 by rdivacky at rdivacky_witten on 2006/08/04 13:07:11

	Fix the previous commit. set != store. Also change the checking of the refcount
	to be atomic as well.

Affected files ...

.. //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_futex.c#14 edit

Differences ...

==== //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_futex.c#14 (text+ko) ====

@@ -284,7 +284,7 @@
 	/* Not found, create it */
 	f = malloc(sizeof(*f), M_LINUX, M_WAITOK);
 	f->f_uaddr = uaddr;
-	atomic_set_int(&f->f_refcount, 1);
+	f->f_refcount = 1;
 	TAILQ_INIT(&f->f_waiting_proc);
 	FUTEX_LOCK;
 	LIST_INSERT_HEAD(&futex_list, f, f_list);
@@ -297,8 +297,7 @@
 futex_put(f)
 	struct futex *f;
 {
-	atomic_add_int(&f->f_refcount, -1);
-	if (f->f_refcount == 0) {
+	if (atomic_fetchadd_int(&f->f_refcount, -1) == 1) {
 		FUTEX_LOCK;
 		LIST_REMOVE(f, f_list);
 		FUTEX_UNLOCK;


More information about the p4-projects mailing list