let call v (f : Viewer.t -> 'a) : 'a =
  let ($) f g x = f (g x) in
  let ch = Event.new_channel () in
    Event.sync (Event.send v.channel (`call (Obj.repr $ f, ch)));
    match Event.sync (Event.receive ch) with
      | Return r -> Obj.obj r
      | Exception_return e -> raise e