Fix long-standing race condition bug in locking unittest
Fix long-standing race condition bug in locking unittest

Every once in a while we saw failures in the locking unittest, but
weren't able to determine the cause. This patch fixes it by using
threading.Event instead of plain threading.Condition to notify another
thread. In most cases, threading.Condition must be used with another
variable to keep the actual state.  threading.Event does this for us.
Otherwise it can happen that the waiter only gets the lock after
condition was notified.

Signed-off-by: Michael Hanselmann <68b67885ff74281219b4a4be33cc20fd45078d7c@google.com>
Reviewed-by: Iustin Pop <acf83a5274f31a43af6b914614365999469c1a31@google.com>

yiannist/ganeti,apyrgio/snf-ganeti,andir/ganeti,apyrgio/ganeti,grnet/snf-ganeti,ganeti-github-testing/ganeti-test-1,dimara/ganeti,bitemyapp/ganeti,mbakke/ganeti,yiannist/ganeti,andir/ganeti,dimara/ganeti,onponomarev/ganeti,mbakke/ganeti,ganeti/ganeti,apyrgio/snf-ganeti,ganeti-github-testing/ganeti-test-1,ganeti/ganeti,onponomarev/ganeti,andir/ganeti,bitemyapp/ganeti,leshchevds/ganeti,ganeti/ganeti,leshchevds/ganeti,yiannist/ganeti,leshchevds/ganeti,grnet/snf-ganeti,mbakke/ganeti,apyrgio/ganeti