mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
socket/unix: clean up socket queue after releasing a queue lock
A socket queue can contain sockets (others and this one). We have to avoid taking locks of the same class where it is possible. PiperOrigin-RevId: 398100744
This commit is contained in:
@@ -59,12 +59,14 @@ func (q *queue) Close() {
|
||||
// q.WriterQueue.Notify(waiter.WritableEvents)
|
||||
func (q *queue) Reset(ctx context.Context) {
|
||||
q.mu.Lock()
|
||||
for cur := q.dataList.Front(); cur != nil; cur = cur.Next() {
|
||||
cur.Release(ctx)
|
||||
}
|
||||
dataList := q.dataList
|
||||
q.dataList.Reset()
|
||||
q.used = 0
|
||||
q.mu.Unlock()
|
||||
|
||||
for cur := dataList.Front(); cur != nil; cur = cur.Next() {
|
||||
cur.Release(ctx)
|
||||
}
|
||||
}
|
||||
|
||||
// DecRef implements RefCounter.DecRef.
|
||||
|
||||
Reference in New Issue
Block a user