MCPcopy Create free account
hub / github.com/cloudwego/netpoll / openDefaultPoll

Function openDefaultPoll

poll_default_linux.go:29–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27}
28
29func openDefaultPoll() (*defaultPoll, error) {
30 poll := new(defaultPoll)
31
32 poll.buf = make([]byte, 8)
33 p, err := EpollCreate(0)
34 if err != nil {
35 return nil, err
36 }
37 poll.fd = p
38
39 r0, _, e0 := syscall.Syscall(syscall.SYS_EVENTFD2, 0, 0, 0)
40 if e0 != 0 {
41 _ = syscall.Close(poll.fd)
42 return nil, e0
43 }
44
45 poll.Reset = poll.reset
46 poll.Handler = poll.handler
47 poll.wop = &FDOperator{FD: int(r0)}
48
49 if err = poll.Control(poll.wop, PollReadable); err != nil {
50 _ = syscall.Close(poll.wop.FD)
51 _ = syscall.Close(poll.fd)
52 return nil, err
53 }
54
55 poll.opcache = newOperatorCache()
56 return poll, nil
57}
58
59type defaultPoll struct {
60 pollArgs

Callers 1

openPollFunction · 0.70

Calls 4

EpollCreateFunction · 0.85
newOperatorCacheFunction · 0.85
CloseMethod · 0.65
ControlMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…