CleanInotify
Clean Inotify wrapper
Documentation is in Inotify.dcl
. Example files:
test.icl
: simply tells you what is happening with filesfile1
andfile2
. 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
:: *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–present Camil Staps. Licensed under MIT, see LICENSE.