+
+let spec =
+ { Http_daemon.default_spec with
+ port = 9999;
+ mode = `Thread;
+ callback = callback;
+ exn_handler = Some safe_unlock;
+ (** ocaml-http's default exn_handler is Pervasives.ignore. This means
+ * that threads holding the "m" mutex above may die without unlocking it.
+ * Using safe_unlock as an exception handler we ensure that "m" mutex is
+ * unlocked in case of exceptions (e.g. SIGPIPE) *)
+ }
+
+let _ = Http_daemon.main spec
+