Skip to content

Commit

Permalink
Add a pp function for Lwt_engine.Ev_backend.t (suggested by @avsm).
Browse files Browse the repository at this point in the history
  • Loading branch information
yallop committed Sep 16, 2016
1 parent c0c8597 commit 268bc37
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/unix/lwt_engine.ml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,17 @@ struct
let kqueue = EV_KQUEUE
let devpoll = EV_DEVPOLL
let port = EV_PORT

let name = function
| EV_DEFAULT -> "EV_DEFAULT"
| EV_SELECT -> "EV_SELECT"
| EV_POLL -> "EV_POLL"
| EV_EPOLL -> "EV_EPOLL"
| EV_KQUEUE -> "EV_KQUEUE"
| EV_DEVPOLL -> "EV_DEVPOLL"
| EV_PORT -> "EV_PORT"

let pp fmt t = Format.pp_print_string fmt (name t)
end

external ev_init : Ev_backend.t -> ev_loop = "lwt_libev_init"
Expand Down
2 changes: 2 additions & 0 deletions src/unix/lwt_engine.mli
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ sig
val kqueue : t
val devpoll : t
val port : t

val pp : Format.formatter -> t -> unit
end

(** Type of libev loops. *)
Expand Down

0 comments on commit 268bc37

Please sign in to comment.