mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
36 lines
519 B
V
36 lines
519 B
V
|
module notify
|
||
|
|
||
|
import time
|
||
|
|
||
|
// Backends should provide a `new() ?FdNotifier` function
|
||
|
pub interface FdNotifier {
|
||
|
add(fd int, events FdEventType, conf ...FdConfigFlags) ?
|
||
|
modify(fd int, events FdEventType, conf ...FdConfigFlags) ?
|
||
|
remove(fd int) ?
|
||
|
wait(timeout time.Duration) []FdEvent
|
||
|
close() ?
|
||
|
}
|
||
|
|
||
|
pub interface FdEvent {
|
||
|
fd int
|
||
|
kind FdEventType
|
||
|
}
|
||
|
|
||
|
[flag]
|
||
|
pub enum FdEventType {
|
||
|
read
|
||
|
write
|
||
|
peer_hangup
|
||
|
exception
|
||
|
error
|
||
|
hangup
|
||
|
}
|
||
|
|
||
|
[flag]
|
||
|
pub enum FdConfigFlags {
|
||
|
edge_trigger
|
||
|
one_shot
|
||
|
wake_up
|
||
|
exclusive
|
||
|
}
|