'Test that an abort will put the barrier in a broken state'

def test_abort(self):

    results1 = []
    results2 = []
    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
    self.run_threads(f)
    self.assertEqual(len(results1), 0)
    self.assertEqual(len(results2), (self.N - 1))
    self.assertTrue(self.barrier.broken)
