Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Aug 2006 13:07:28 GMT
From:      Roman Divacky <rdivacky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 103163 for review
Message-ID:  <200608041307.k74D7S01087574@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=103163

Change 103163 by rdivacky@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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608041307.k74D7S01087574>