Sys.Signals module for a Variant type of signals (and a set_signal function that...
[ocaml.git] / otherlibs / labltk / frx / frx_after.ml
blob7fe6a4f2a554bd9f723158b6838ecf3151d7a2a7
1 (***********************************************************************)
2 (* *)
3 (* MLTk, Tcl/Tk interface of Objective Caml *)
4 (* *)
5 (* Francois Rouaix, Francois Pessaux, Jun Furuse and Pierre Weis *)
6 (* projet Cristal, INRIA Rocquencourt *)
7 (* Jacques Garrigue, Kyoto University RIMS *)
8 (* *)
9 (* Copyright 2002 Institut National de Recherche en Informatique et *)
10 (* en Automatique and Kyoto University. All rights reserved. *)
11 (* This file is distributed under the terms of the GNU Library *)
12 (* General Public License, with the special exception on linking *)
13 (* described in file LICENSE found in the Objective Caml source tree. *)
14 (* *)
15 (***********************************************************************)
16 open Protocol
17 let idle f =
18 let id = new_function_id () in
19 let wrapped _ =
20 clear_callback id; (* do it first in case f raises exception *)
21 f() in
22 Hashtbl.add callback_naming_table id wrapped;
23 tkCommand [| TkToken "after"; TkToken "idle";
24 TkToken ("camlcb "^ string_of_cbid id) |]