'Test that (lazy) compiling from several threads at once doesn\'t
produce errors (see issue #908).'

def test_lock(self):

    errors = []
    @jit
    def foo(x):
        return (x + 1)
    def wrapper():
        try:
            self.assertEqual(foo(1), 2)
        except BaseException as e:
            errors.append(e)
    threads = [threading.Thread(target=wrapper) for i in range(16)]
    for t in threads:
        t.start()
    for t in threads:
        t.join()
    self.assertFalse(errors)
