-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(graph): make barrier more robust (#474)
- Loading branch information
1 parent
085c61e
commit c8f8a7b
Showing
1 changed file
with
10 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -418,18 +418,21 @@ impl EszipDataSection { | |
pub async fn read_data_section_all(self: Arc<Self>) -> Result<(), ParseError> { | ||
// NOTE: Below codes is roughly originated from [email protected]/src/v2.rs | ||
|
||
let this = { | ||
let sem = self.read_all_barrier.clone(); | ||
let sem = self.read_all_barrier.clone(); | ||
let this = loop { | ||
let permit = sem | ||
.acquire_many(READ_ALL_BARRIER_MAX_PERMITS as u32) | ||
.await | ||
.unwrap(); | ||
|
||
let this = Arc::into_inner(self).unwrap(); | ||
|
||
sem.close(); | ||
drop(permit); | ||
this | ||
if Arc::strong_count(&self) != 1 { | ||
drop(permit); | ||
tokio::task::yield_now().await; | ||
continue; | ||
} else { | ||
sem.close(); | ||
break Arc::into_inner(self).unwrap(); | ||
} | ||
}; | ||
|
||
let modules = this.modules; | ||
|