File tree Expand file tree Collapse file tree 2 files changed +16
-17
lines changed
Expand file tree Collapse file tree 2 files changed +16
-17
lines changed Original file line number Diff line number Diff line change @@ -435,18 +435,15 @@ impl FD {
435435 self.pd.evict()
436436 }
437437
438+ defer {
439+ // Wait until the descriptor is closed. If this was the only
440+ // reference, it is already closed.
441+ semacquire(&self.csema).await
442+ }
443+
438444 // The call to decref will call destroy if there are no other
439445 // references.
440- let mut err: any
441- self.decref() else { err = error }
442-
443- // Wait until the descriptor is closed. If this was the only
444- // reference, it is already closed.
445- semacquire(&self.csema).await
446-
447- if err != nil {
448- throw err
449- }
446+ self.decref()?
450447 }
451448}
452449
Original file line number Diff line number Diff line change @@ -624,14 +624,16 @@ impl FD {
624624 if self.pollable && self.pd != nil {
625625 self.pd.evict()
626626 }
627- let mut err: any
628- self.decref() else { err = error }
629- // Wait until the descriptor is closed. If this was the only
630- // reference, it is already closed.
631- semacquire(&self.csema).await
632- if err != nil {
633- throw err
627+
628+ defer {
629+ // Wait until the descriptor is closed. If this was the only
630+ // reference, it is already closed.
631+ semacquire(&self.csema).await
634632 }
633+
634+ // The call to decref will call destroy if there are no other
635+ // references.
636+ self.decref()?
635637 }
636638
637639 // Waits for cancellation.
You can’t perform that action at this time.
0 commit comments