diff -u src/libevent.ml src2/libevent.ml
--- src/libevent.ml	2007-04-20 13:57:53.000000000 +0300
+++ src2/libevent.ml	2007-04-20 16:31:32.000000000 +0300
@@ -22,10 +22,14 @@
 
 type event_callback = Unix.file_descr -> event_flags list -> unit
 
+exception UncaughtExceptions of (exn list)
+
 (* Use an internal hashtable to store the ocaml callbacks with the
    event *)
 let table = Hashtbl.create 0
 
+let exns = ref []
+
 (* Precalculated as to reduce runtime impact *)
 let event_types_list_of_int =
   let types = [TIMEOUT; READ; WRITE; SIGNAL] in
@@ -39,7 +43,12 @@
 
 (* Called by the c-stub, locate, and call the ocaml callback *)
 let event_cb event_id fd etype =
-  (Hashtbl.find table event_id) fd (event_types_list_of_int etype)
+  let ev = Hashtbl.find table event_id in 
+    try 
+      ev fd (event_types_list_of_int etype)
+    with 
+      | exn -> 
+	  exns := exn::!exns;
   
 (* Create an event *)
 external create : unit -> event = "oc_create_event"
@@ -97,16 +106,28 @@
 external pending : event -> event_flags list -> bool = "oc_event_pending"
 
 (* Process events *)
-external dispatch : unit -> unit = "oc_event_dispatch"
+external do_dispatch : unit -> unit = "oc_event_dispatch"
+
+let handle_exns () =
+  match !exns with
+    | [] -> ()
+    | exns' ->
+	exns := [];
+	raise (UncaughtExceptions exns')
+
+let dispatch () =
+  do_dispatch ();
+  handle_exns ()
 
 type loop_flags = ONCE | NONBLOCK
-external loop : loop_flags -> unit = "oc_event_loop"
+external do_loop : loop_flags -> unit = "oc_event_loop"
+
+let loop flags =
+  do_loop flags;
+  handle_exns ()
 
 (* Initialize the event library *)
 external init : unit -> unit = "oc_event_init"
 let _ = 
   Callback.register "event_cb" event_cb;
   init ()
-
-
-
diff -u src/libevent.mli src2/libevent.mli
--- src/libevent.mli	2007-04-20 13:57:53.000000000 +0300
+++ src2/libevent.mli	2007-04-20 16:11:24.000000000 +0300
@@ -35,6 +35,10 @@
 type event_callback = Unix.file_descr -> event_flags list -> unit
 (** The type of event callbacks *)
 
+(** Callback-functions threw exceptions; they'll be rethrown within this
+    exception by the dispatch- and loop-functions *)
+exception UncaughtExceptions of (exn list)
+
 (** {5 Basic Libevent Operations} *)
 
 val create : unit -> event
