blob: 3247505c701a9bd1a05eb3d98d2497a8e584a16c (
plain) (
blame)
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
|
# 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–present Camil Staps.
Licensed under MIT, see [LICENSE](/LICENSE).
[Clean]: http://clean.cs.ru.nl
|