I'd prefer an atomic reference or a promise that gets completed by the recover function, this is subject to memory visibility issues that could cause the test to randomly fail.