mirror of
https://github.com/vlang/v.git
synced 2025-09-14 23:12:33 +03:00
os: create epoll wrapper (#10404)
This commit is contained in:
parent
f922fc2a59
commit
e328b1d292
4 changed files with 397 additions and 0 deletions
35
vlib/os/notify/notify.v
Normal file
35
vlib/os/notify/notify.v
Normal file
|
@ -0,0 +1,35 @@
|
|||
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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue