diff options
author | Camil Staps | 2016-05-21 14:13:01 +0200 |
---|---|---|
committer | Camil Staps | 2016-05-21 14:13:01 +0200 |
commit | 2971bf46bbed158f9622d83fdeb7fb4fc04689f0 (patch) | |
tree | 1a769b5d212f64e9b98ad539aea4e8c46e12aa96 | |
parent | Documentation; inotify_is_event; timeout for polling (diff) |
Readme; 80 chars
-rw-r--r-- | Inotify.dcl | 3 | ||||
-rw-r--r-- | Inotify.icl | 3 | ||||
-rw-r--r-- | README.md | 40 |
3 files changed, 44 insertions, 2 deletions
diff --git a/Inotify.dcl b/Inotify.dcl index c3a3e05..82c83c1 100644 --- a/Inotify.dcl +++ b/Inotify.dcl @@ -73,7 +73,8 @@ inotify_is_event :: INMask INEvent -> Bool * Combination of inotify_poll and inotify_check that will return only if no * events were given when a timeout occurred. */ -inotify_loop_with_timeout :: !(Maybe Int) !*(Inotify st) !*World -> *(!*Inotify st, !*World) +inotify_loop_with_timeout :: !(Maybe Int) !*(Inotify st) !*World + -> *(!*Inotify st, !*World) /** * inotify_loop_with_timeout with Nothing as timeout (will never return) diff --git a/Inotify.icl b/Inotify.icl index 205aba9..d25a426 100644 --- a/Inotify.icl +++ b/Inotify.icl @@ -122,7 +122,8 @@ where inotify_is_event :: INMask INEvent -> Bool inotify_is_event mask ev = ev bitand mask <> 0 -inotify_loop_with_timeout :: !(Maybe Int) !*(Inotify st) !*World -> *(!*Inotify st, !*World) +inotify_loop_with_timeout :: !(Maybe Int) !*(Inotify st) !*World + -> *(!*Inotify st, !*World) inotify_loop_with_timeout to inot w # (n,inot) = inotify_poll to inot | n == 0 = (inot,w) @@ -1,6 +1,46 @@ # CleanInotify Clean Inotify wrapper +Documentation is in `Inotify.dcl`. Example files: + +- `test.icl`: simply tells you what is happening with files `file1` and + `file2`. Will exit if nothing has happened for 10s. +- `test_reload.icl`: will exit automatically when its own binary changes. This + allows you to put it in a loop, `while :; do ./test_reload; done` and gives + you a program that restarts automatically when it has been changed. + +More details in these files themselves. + +## API + +```clean +:: *Inotify st +:: INWatch + +:: INMask :== Int +:: INEvent :== Int + +:: INCallback st :== INEvent (Maybe String) st *World -> *(st, *World) + +(|-) infixl 6 :: (INMask INMask -> INMask) + +inotify_init :: st -> Maybe *(Inotify st) +inotify_close :: *(Inotify st) -> st + +inotify_add_watch :: (INCallback st) !INMask !String !*(Inotify st) + -> *(!Either Int INWatch, !*Inotify st) +inotify_rm_watch :: !INWatch !*(Inotify st) -> *(!Bool, !*Inotify st) + +inotify_poll :: !(Maybe Int) !*(Inotify st) -> *(!Int, !*Inotify st) +inotify_check :: !*(Inotify st) !*World -> *(!*Inotify st, !*World) + +inotify_is_event :: INMask INEvent -> Bool + +inotify_loop_with_timeout :: !(Maybe Int) !*(Inotify st) !*World + -> *(!*Inotify st, !*World) +inotify_loop_forever :: !*(Inotify st) !*World -> *(!*Inotify st, !*World) +``` + ## Copyright & license Copyright © 2016 Camil Staps. Licensed under MIT, see LICENSE. |