misc: Simplify DynamicBarrier implemenation

DynamicBarrier uses a threading.Condition. The condition
already contain a lock, used to synchronize enter() and exit().

Within the critical sections in enter() and exit(), only one thread can
run. When a thread call self._cond.wait(), the condition lock is
released atomically and the next thread waiting on the condition lock
continue to run. When a thread return from self.cond.wait(), it get the
condition lock and run, while all other threads are waiting on the
condition lock. This is ensured by threading.Condition, both Python
builtin and pthread_cond when using pthreading.

To keep a boolean state of the barrier, we don't need another lock, a
boolean is just fine.

Previously, when trying to exit a barrier without entering it, a
ThreadError was raised:

    thread.error: release unlocked lock

Now a more specific and useful message is raised:

    AssertionError: Attempt to exit a barrier without entering

Change-Id: Ia403cd9f734eaafdce95ba5123e54ec4e4939172
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/29003
Reviewed-by: Saggi Mizrahi <smizrahi@redhat.com>