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

Method free

fd_operator_cache.go:74–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

72}
73
74func (c *operatorCache) free() {
75 lock(&c.freelocked)
76 defer unlock(&c.freelocked)
77 if len(c.freelist) == 0 {
78 return
79 }
80
81 lock(&c.locked)
82 for _, idx := range c.freelist {
83 op := c.cache[idx]
84 op.next = c.first
85 c.first = op
86 }
87 c.freelist = c.freelist[:0]
88 unlock(&c.locked)
89}
90
91func lock(locked *int32) {
92 for !atomic.CompareAndSwapInt32(locked, 0, 1) {

Callers 5

WaitMethod · 0.80
TestPersistFDOperatorFunction · 0.80
WaitMethod · 0.80

Calls 2

lockFunction · 0.85
unlockFunction · 0.85

Tested by 3

TestPersistFDOperatorFunction · 0.64