let wrap_event f = wrap_event (fun () -> try f (get_event_arg ()) ; Thread.exit (); with e -> Thread.thread_uncaught_exception e; Thread.exit ())