From 1b355d8a87a3ad43bf240aa66b88eb98c1cd777f Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 5 Jun 2024 15:17:35 -0400 Subject: refactor(npm): improve locking around updating npm resolution (#24104) Introduces a `SyncReadAsyncWriteLock` to make it harder to write to the npm resolution without first waiting async in a queue. For the npm resolution, reading synchronously is fine, but when updating, someone should wait async, clone the data, then write the data at the end back. --- cli/util/sync/mod.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 cli/util/sync/mod.rs (limited to 'cli/util/sync/mod.rs') diff --git a/cli/util/sync/mod.rs b/cli/util/sync/mod.rs new file mode 100644 index 000000000..28aab7f47 --- /dev/null +++ b/cli/util/sync/mod.rs @@ -0,0 +1,14 @@ +// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +mod async_flag; +mod atomic_flag; +mod sync_read_async_write_lock; +mod task_queue; +mod value_creator; + +pub use async_flag::AsyncFlag; +pub use atomic_flag::AtomicFlag; +pub use sync_read_async_write_lock::SyncReadAsyncWriteLock; +pub use task_queue::TaskQueue; +pub use task_queue::TaskQueuePermit; +pub use value_creator::MultiRuntimeAsyncValueCreator; -- cgit v1.2.3