Skip to content

Commit 453d010

Browse files
committed
stamp: polishing
1 parent 6bda1e4 commit 453d010

File tree

3 files changed

+0
-49
lines changed

3 files changed

+0
-49
lines changed

crates/base/src/runtime/mod.rs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ use serde::Serialize;
102102
use strum::IntoStaticStr;
103103
use tokio::runtime::Handle;
104104
use tokio::sync::mpsc;
105-
use tokio::sync::OwnedSemaphorePermit;
106-
use tokio::sync::Semaphore;
107105
use tokio::time::interval;
108106
use tokio_util::sync::CancellationToken;
109107
use tracing::debug;
@@ -158,15 +156,6 @@ pub static SHOULD_INCLUDE_MALLOCED_MEMORY_ON_MEMCHECK: OnceCell<bool> =
158156
OnceCell::new();
159157
pub static MAYBE_DENO_VERSION: OnceCell<String> = OnceCell::new();
160158

161-
thread_local! {
162-
// NOTE: Suppose we have met `.await` points while initializing a
163-
// DenoRuntime. In that case, the current v8 isolate's thread-local state
164-
// can be corrupted by a task initializing another DenoRuntime, so we must
165-
// prevent this with a Semaphore.
166-
167-
static RUNTIME_CREATION_SEM: Arc<Semaphore> = Arc::new(Semaphore::new(1));
168-
}
169-
170159
#[ctor]
171160
fn init_v8_platform() {
172161
set_v8_flags();
@@ -460,16 +449,6 @@ impl<RuntimeContext> Drop for DenoRuntime<RuntimeContext> {
460449
}
461450
}
462451

463-
impl DenoRuntime<DefaultRuntimeContext> {
464-
pub async fn acquire() -> OwnedSemaphorePermit {
465-
RUNTIME_CREATION_SEM
466-
.with(|v| v.clone())
467-
.acquire_owned()
468-
.await
469-
.unwrap()
470-
}
471-
}
472-
473452
impl<RuntimeContext> DenoRuntime<RuntimeContext> {
474453
#[inline]
475454
fn assert_isolate_not_locked(&mut self) {
@@ -1489,22 +1468,8 @@ where
14891468

14901469
let state = self.runtime_state.clone();
14911470
let mem_check_state = is_user_worker.then(|| self.mem_check.clone());
1492-
// let mut poll_sem = None::<PollSemaphore>;
14931471

14941472
poll_fn(move |cx| {
1495-
// if poll_sem.is_none() {
1496-
// poll_sem =
1497-
// Some(RUNTIME_CREATION_SEM.with(|v| PollSemaphore::new(v.clone())));
1498-
// }
1499-
1500-
// let Poll::Ready(Some(_permit)) =
1501-
// poll_sem.as_mut().unwrap().poll_acquire(cx)
1502-
// else {
1503-
// return Poll::Pending;
1504-
// };
1505-
1506-
// poll_sem = None;
1507-
15081473
let waker = cx.waker();
15091474
let woked = global_waker.take().is_none();
15101475

crates/base/src/worker/supervisor/strategy_per_worker.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ pub async fn supervise(args: Arguments) -> (ShutdownReason, i64) {
295295
match metrics {
296296
CPUUsageMetrics::Enter(_thread_id, timer) => {
297297
state.worker_enter();
298-
error!("cpu enter: {:?}, {:?}", _thread_id, std::thread::current());
299298

300299
if !state.is_cpu_time_limit_disabled {
301300
cpu_timer_rx = Some(timer.set_channel().in_current_span().await);

crates/base/src/worker/worker_inner.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ impl Worker {
226226

227227
let rt = imp.runtime_handle();
228228
let worker_fut = async move {
229-
// let permit = DenoRuntime::acquire().await;
230229
let new_runtime = 'scope: {
231230
match DenoRuntime::new(self).await {
232231
Ok(mut v) => {
@@ -243,25 +242,13 @@ impl Worker {
243242
let mut new_runtime = match new_runtime {
244243
Ok(v) => v,
245244
Err(err) => {
246-
// drop(permit);
247-
248245
let err = CloneableError::from(err.context("worker boot error"));
249246
let _ = booter_signal.send(Err(err.clone().into()));
250247

251248
return Some(imp.on_boot_error(err.into()).await);
252249
}
253250
};
254251

255-
// let mut runtime = scopeguard::guard(new_runtime, |mut runtime| unsafe {
256-
// runtime.js_runtime.v8_isolate().enter();
257-
// });
258-
259-
// unsafe {
260-
// runtime.js_runtime.v8_isolate().exit();
261-
// }
262-
263-
// drop(permit);
264-
265252
let metric_src = {
266253
let metric_src =
267254
WorkerMetricSource::from_js_runtime(&mut new_runtime.js_runtime);

0 commit comments

Comments
 (0)