'Test that a barrier can be reset after being broken.'

def test_abort_and_reset(self):

    results1 = []
    results2 = []
    results3 = []
    barrier2 = self.barriertype(self.N)
    def f():
        try:
            i = self.barrier.wait()
            if (i == (self.N // 2)):
                raise RuntimeError
            self.barrier.wait()
            results1.append(True)
        except threading.BrokenBarrierError:
            results2.append(True)
        except RuntimeError:
            self.barrier.abort()
            pass
        if (barrier2.wait() == (self.N // 2)):
            self.barrier.reset()
        barrier2.wait()
        self.barrier.wait()
        results3.append(True)
    self.run_threads(f)
    self.assertEqual(len(results1), 0)
    self.assertEqual(len(results2), (self.N - 1))
    self.assertEqual(len(results3), self.N)
