File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -418,18 +418,21 @@ impl EszipDataSection {
418
418
pub async fn read_data_section_all ( self : Arc < Self > ) -> Result < ( ) , ParseError > {
419
419
// NOTE: Below codes is roughly originated from eszip@0.72.2/src/v2.rs
420
420
421
- let this = {
422
- let sem = self . read_all_barrier . clone ( ) ;
421
+ let sem = self . read_all_barrier . clone ( ) ;
422
+ let this = loop {
423
423
let permit = sem
424
424
. acquire_many ( READ_ALL_BARRIER_MAX_PERMITS as u32 )
425
425
. await
426
426
. unwrap ( ) ;
427
427
428
- let this = Arc :: into_inner ( self ) . unwrap ( ) ;
429
-
430
- sem. close ( ) ;
431
- drop ( permit) ;
432
- this
428
+ if Arc :: strong_count ( & self ) != 1 {
429
+ drop ( permit) ;
430
+ tokio:: task:: yield_now ( ) . await ;
431
+ continue ;
432
+ } else {
433
+ sem. close ( ) ;
434
+ break Arc :: into_inner ( self ) . unwrap ( ) ;
435
+ }
433
436
} ;
434
437
435
438
let modules = this. modules ;
You can’t perform that action at this time.
0 commit comments