X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fdwatcher.ml;h=3453d54f78e16238dc93bb8d2addbcb074c2c80c;hb=10d5ee4bc0c1fb4b74001c45c877c9c0c74205b9;hp=3e3142737ae50e21da16f8888495f54676dfe29c;hpb=2955cde23cac50c0ad569745974746993b171524;p=vsys.git diff --git a/fdwatcher.ml b/fdwatcher.ml index 3e31427..3453d54 100644 --- a/fdwatcher.ml +++ b/fdwatcher.ml @@ -1,3 +1,6 @@ +(** Fdwatcher - The main event loop. Agnostic to the type of file descriptors + involved.*) + open Printf open Globals @@ -8,15 +11,14 @@ let cbtable = Hashtbl.create 1024 * fifo outputs, the out descriptor must be opened a nouveau whenever we * want to send out data, and so we keep the associated filename as well. * Same with input fifos. Yipee.*) - -let add_fd (evpair:fd_and_fname) (fd_other:fd_and_fname) (callback:fd_and_fname->fd_and_fname->unit) = +let add_fd (evpair:fname_and_fd) (fd_other:fname_and_fd) (callback:fname_and_fd->fname_and_fd->unit) = let (fname,fd) = evpair in fdset := (fd::!fdset); Hashtbl.replace cbtable fd (callback,(evpair,fd_other)) let del_fd fd = fdset:=List.filter (fun l->l<>fd) !fdset; - flush Pervasives.stdout + flush logfd let start_watch () = while (true) @@ -29,4 +31,3 @@ let start_watch () = let (func,(evd,fd_other)) = Hashtbl.find cbtable elt in func evd fd_other) fds done -