let try_to_pass w =
match w.color with
| `Green -> return ()
| `Red ->
begin match Lwt.state w.lwt_t with
| Lwt.Sleep -> ()
| Lwt.Return () | Lwt.Fail _ ->
(* we need to renew the “task” *)
let t, u = Lwt.task () in
w.lwt_t <- t;
w.lwt_u <- u;
end;
wrap_deferred ~on_exn:(fun e -> e) (fun () -> w.lwt_t)
>>< function
| `Error Lwt.Canceled -> return ()
| `Error other -> failwith "BUG: THIS SHOULD NOT HAPPEN"
| `Ok () -> return ()