On Sat, Jan 29, 2011 at 12:26:17PM +0000, Alexander Best wrote: > hi there, > > i've spent a couple of hours hacking support for futex operators > FUTEX_WAIT_BITSET and FUTEX_WAKE_BITSET into the linuxulator. the following > patch is far from perfect and in certain places it is probably doing the wrong > thing, however it doesn't seem to break anything. > > i'd appreciate if somebody could have a look at the patch and point out any > issues. please note that the patch also contains a few unrelated comment > changes and such (however only very few). > > thanks in advance. > > the patch can be found in here: > > http://people.freebsd.org/~arundel/drafts/futex.diff >
@@ -264,7 +265,7 @@
}
static int
-futex_wake(struct futex *f, int n)
+futex_wake(struct futex *f, int n, int val3)
{
struct waiting_proc *wp, *wpt;
int count = 0;
@@ -275,6 +276,11 @@
f->f_uaddr, wp, f->f_refcount);
wp->wp_flags |= FUTEX_WP_REMOVED;
TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
+
+ /* Unless we find a matching bit in */
+ /* the bitmask, continue searching. */
+ if (!(wp->wp_futex->f_bitmask & val3))
+ continue;
wakeup_one(wp);
if (++count == n)
break;
@@ -325,13 +331,16 @@
probably error here, you should test bitset before removing wp from
tailq.
--
Have fun!
chd
pgpQyIBs8ikHE.pgp
Description: PGP signature
