@@ -38,12 +38,14 @@ let _fake_event = {
3838let fake_event = ref _fake_event
3939
4040type engine_id = ..
41+ type engine_id + = Engine_id__other
4142
4243(* +-----------------------------------------------------------------+
4344 | Engines |
4445 +-----------------------------------------------------------------+ *)
4546
4647class virtual abstract = object (self )
48+ method id = Engine_id__other
4749 method virtual iter : bool -> unit
4850 method virtual private cleanup : unit
4951 method virtual private register_readable : Unix. file_descr -> (unit -> unit ) -> unit Lazy. t
@@ -174,9 +176,12 @@ external ev_io_stop : ev_loop -> ev_io -> unit = "lwt_libev_io_stop"
174176external ev_timer_init : ev_loop -> float -> bool -> (unit -> unit ) -> ev_timer = " lwt_libev_timer_init"
175177external ev_timer_stop : ev_loop -> ev_timer -> unit = " lwt_libev_timer_stop"
176178
179+ type engine_id + = Engine_id__libev of Ev_backend .t
177180class libev ?(backend =Ev_backend. default) () = object
178181 inherit abstract
179182
183+ method! id = Engine_id__libev backend
184+
180185 val loop = ev_init backend
181186 method loop = loop
182187
@@ -332,9 +337,12 @@ class virtual select_or_poll_based = object
332337 if Lwt_sequence. is_empty actions then wait_writable < - Fd_map. remove fd wait_writable)
333338end
334339
340+ type engine_id + = Engine_id__select
335341class virtual select_based = object (self )
336342 inherit select_or_poll_based
337343
344+ method! id = Engine_id__select
345+
338346 method private virtual select : Unix. file_descr list -> Unix. file_descr list -> float -> Unix. file_descr list * Unix. file_descr list
339347
340348 method iter block =
@@ -367,9 +375,12 @@ class virtual select_based = object(self)
367375 List. iter (fun fd -> invoke_actions fd wait_writable) fds_w
368376end
369377
378+ type engine_id + = Engine_id__poll
370379class virtual poll_based = object (self )
371380 inherit select_or_poll_based
372381
382+ method! id = Engine_id__select
383+
373384 method private virtual poll : (Unix. file_descr * bool * bool ) list -> float -> (Unix. file_descr * bool * bool ) list
374385
375386 method iter block =
@@ -431,6 +442,7 @@ let set ?(transfer=true) ?(destroy=true) engine =
431442 if destroy then ! current#destroy;
432443 current := (engine : #t :> t )
433444
445+ let id () = ! current#id
434446let iter block = ! current#iter block
435447let on_readable fd f = ! current#on_readable fd f
436448let on_writable fd f = ! current#on_writable fd f
0 commit comments