v.io/x/lib/nsync: bug fix when not transfering waiters from CV to Mu

In CV's wakeWaiters() call, I set the mutex's muDesigWaker bit
if all the threads signalled are woken, and none are transferred.
Unfortunately, I did this irrespective of the state of the mutex.
It's legal to set the muDesigWaker only if neither the spinlock or
mutex or held by a thread other than the current thread.

This change tests for that condition.  It also does sets muDesigWaker if it can
on the first try.  It does not wait, since setting this bit is an optimization.

This change also adds a new test (cv_timeout_stress_test.go) which
unconvered the bug, and an AssertHeld() call on mutex.

Change-Id: I4cf01178361e2c39c9d1451bdda268ad05829805
4 files changed