Update pthread futex_waiti() to unlock after yield

The previous version of the futex code was adopted from the linux parlib
code, which doesn't have to worry about uthreads spuriously dropping
into vcore context while not holding a pdr lock.  Without this change,
it was possible for a vcore to spin indefinitely on a futex_wait() while
the uthread it was trying to wake had not actually yielded yet (and
couldn't because it was trying to yield on the very same vcore that was
spinning trying to wake it).

With this change we now have to hold the futex lock a little longer, but
it is necessary for correctness.  In the future, we will probably want
to use some sort of hashtable to maintain one lock per futex, rather
than a global futex lock, and this will help alleviate some of these
costs.
2 files changed