package inotify
Inotify bindings for OCaml
Install
Dune Dependency
Authors
Maintainers
Sources
inotify-2.6.tbz
sha256=1d103e7dd32fddd0f1201b2d2f6c5b762548277bc173beef7b072f30ea89ccc4
sha512=660a44e3083f76f0342a6214ba9df4e18b42cc5da833cae3200345e5f0c5c353a3d67dace21ba00d3365d6866a82c90e5b732c9f8e3d9e38687239d6d0fe41f5
doc/src/inotify.lwt/lwt_inotify.ml.html
Source file lwt_inotify.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
open Lwt type t = { queue : Inotify.event Queue.t; unix_fd : Unix.file_descr; lwt_fd : Lwt_unix.file_descr; } let create' () = let unix_fd = Inotify.create () in { queue = Queue.create (); lwt_fd = Lwt_unix.of_unix_file_descr unix_fd; unix_fd; } let create () = try return (create' ()) with exn -> Lwt.fail exn let add_watch' inotify path selector = Inotify.add_watch inotify.unix_fd path selector let add_watch inotify path selector = try return (add_watch' inotify path selector) with exn -> Lwt.fail exn let rm_watch' inotify wd = Inotify.rm_watch inotify.unix_fd wd let rm_watch inotify wd = try return (rm_watch' inotify wd) with exn -> Lwt.fail exn let rec read inotify = try return (Queue.take inotify.queue) with Queue.Empty -> Lwt_unix.wait_read inotify.lwt_fd >>= fun () -> begin try let events = Inotify.read inotify.unix_fd in List.iter (fun event -> Queue.push event inotify.queue) events; return_unit with exn -> Lwt.fail exn end >>= fun () -> read inotify let rec try_read inotify = try return (Some (Queue.take inotify.queue)) with Queue.Empty -> if Lwt_unix.readable inotify.lwt_fd then read inotify >|= fun x -> Some x else return_none let close inotify = Lwt_unix.close inotify.lwt_fd
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>