Skip to content

Commit

Permalink
Breaking: switch to new Lwt_engine.libev
Browse files Browse the repository at this point in the history
Originally added in #269.
  • Loading branch information
aantron committed Apr 10, 2017
1 parent d295887 commit 89d1a60
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
10 changes: 5 additions & 5 deletions src/unix/lwt_engine.ml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ external ev_io_stop : ev_loop -> ev_io -> unit = "lwt_libev_io_stop"
external ev_timer_init : ev_loop -> float -> bool -> (unit -> unit) -> ev_timer = "lwt_libev_timer_init"
external ev_timer_stop : ev_loop -> ev_timer -> unit = "lwt_libev_timer_stop"

class libev' ?(backend=Ev_backend.default) () = object
class libev ?(backend=Ev_backend.default) () = object
inherit abstract

val loop = ev_init backend
Expand Down Expand Up @@ -203,7 +203,7 @@ class libev' ?(backend=Ev_backend.default) () = object
lazy(ev_timer_stop loop ev)
end

class libev = libev' ()
class libev_deprecated = libev ()

(* +-----------------------------------------------------------------+
| Select/poll based engines |
Expand Down Expand Up @@ -418,7 +418,7 @@ end

let current =
if Lwt_config._HAVE_LIBEV && Lwt_config.libev_default then
ref (new libev :> t)
ref (new libev () :> t)
else
ref (new select :> t)

Expand All @@ -441,6 +441,6 @@ let timer_count () = !current#timer_count

module Versioned =
struct
class libev_1 = libev
class libev_2 = libev'
class libev_1 = libev_deprecated
class libev_2 = libev
end
23 changes: 12 additions & 11 deletions src/unix/lwt_engine.mli
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ end

(** Engine based on libev. If not compiled with libev support, the
creation of the class will raise {!Lwt_sys.Not_available}. *)
class libev : object
class libev : ?backend:Ev_backend.t -> unit -> object
inherit t

val loop : ev_loop
Expand All @@ -156,13 +156,6 @@ class libev : object
method loop : ev_loop
(** Returns [loop]. *)
end
[@@ocaml.deprecated
" This class will soon have parameters for selecting a libev backend. This will
be a breaking change in Lwt 3.0.0. See
https://github.com/ocsigen/lwt/pull/269
To preserve the current signature, use Lwt_engine.Versioned.libev_1
To use the replacement immediately, use Lwt_engine.Versioned.libev_2 ()
Both alternatives require Lwt >= 2.7.0."]

(** Engine based on [Unix.select]. *)
class select : t
Expand Down Expand Up @@ -223,15 +216,23 @@ sig
method loop : ev_loop
end
[@@ocaml.deprecated
"Deprecated in favor of Lwt_engine.Versioned.libev_2. See
" Deprecated in favor of Lwt_engine.libev. See
https://github.com/ocsigen/lwt/pull/269"]
(** @deprecated In favor of {!libev_2}.
(** Old version of {!Lwt_engine.libev}. The current {!Lwt_engine.libev} allows
selecting the libev back end.
@deprecated Use {!Lwt_engine.libev}.
@since 2.7.0 *)

(** @since 2.7.0 *)
class libev_2 : ?backend:Ev_backend.t -> unit -> object
inherit t
val loop : ev_loop
method loop : ev_loop
end
[@@ocaml.deprecated
" In Lwt >= 3.0.0, this is an alias for Lwt_engine.libev."]
(** Since Lwt 3.0.0, this is just an alias for {!Lwt_engine.libev}.
@deprecated Use {!Lwt_engine.libev}.
@since 2.7.0 *)
end

0 comments on commit 89d1a60

Please sign in to comment.