Skip to content

Commit b1dc8dd

Browse files
authored
Merge pull request #14 from ifplusor/fix-get-cqe
fix: return copy of CQE
2 parents 30825ba + 39243c5 commit b1dc8dd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

iouring.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,10 @@ func (iour *IOURing) getCQEvent(wait bool) (cqe *iouring_syscall.CompletionQueue
317317
var tryPeeks int
318318
for {
319319
if cqe = iour.cq.peek(); cqe != nil {
320+
// Copy CQE.
321+
cqe2 := *cqe
320322
iour.cq.advance(1)
323+
cqe = &cqe2
321324
return
322325
}
323326

0 commit comments

Comments
 (0)