Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/concat_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,14 @@ impl ConcatSource {

/// Add a [Source] to concat.
pub fn add<S: Source + 'static>(&mut self, source: S) {
let children = &mut *self.children.lock().unwrap();
// `&mut self` guarantees exclusive access, so the Mutex doesn't need to be
// locked here — `get_mut` skips the atomic acquire/release. This matters
// because `add` is called many hundreds of times per chunk in rspack's
// code-generation hot path.
let children = self
.children
.get_mut()
.expect("ConcatSource children mutex poisoned");

if let Some(optimized_children) = self.is_optimized.take() {
*children = optimized_children;
Expand Down
Loading