diff --git a/distaff/src/join.rs b/distaff/src/join.rs index 29f6a78..a9a33b2 100644 --- a/distaff/src/join.rs +++ b/distaff/src/join.rs @@ -24,14 +24,20 @@ impl WorkerThread { (ra, rb) } - /// This function must be called from a worker thread. #[inline] - #[tracing::instrument(level = "trace", skip_all)] - pub(crate) fn join_heartbeat_every( - &self, - a: A, - b: B, - ) -> (RA, RB) + pub(crate) fn join_heartbeat_every(&self, a: A, b: B) -> (RA, RB) + where + A: FnOnce() -> RA + Send, + B: FnOnce() -> RB, + RA: Send, + { + // self.join_heartbeat_every_inner::(a, b) + self.join_heartbeat(a, b) + } + + /// This function must be called from a worker thread. + #[inline(always)] + fn join_heartbeat_every_inner(&self, a: A, b: B) -> (RA, RB) where RA: Send, A: FnOnce() -> RA + Send, @@ -48,10 +54,6 @@ impl WorkerThread { // SAFETY: this function runs in a worker thread, so we can access the queue safely. if count == 0 || queue_len < 3 { cold_path(); - tracing::trace!( - queue_len = queue_len, - "join_heartbeat_every: using heartbeat join", - ); self.join_heartbeat(a, b) } else { self.join_seq(a, b) @@ -122,7 +124,7 @@ impl Context { RB: Send, { // SAFETY: join_heartbeat_every is safe to call from a worker thread. - self.run_in_worker(move |worker| worker.join_heartbeat_every::<_, _, _, _, 64>(a, b)) + self.run_in_worker(move |worker| worker.join_heartbeat_every::<_, _, _, _>(a, b)) } } diff --git a/distaff/src/scope.rs b/distaff/src/scope.rs index 6195f74..813736e 100644 --- a/distaff/src/scope.rs +++ b/distaff/src/scope.rs @@ -277,7 +277,7 @@ impl<'scope, 'env> Scope<'scope, 'env> { let worker = WorkerThread::current_ref().expect("join is run in workerthread."); let this = SendPtr::new_const(self).unwrap(); - worker.join_heartbeat_every::<_, _, _, _, 64>( + worker.join_heartbeat_every::<_, _, _, _>( { let this = this; move || a(unsafe { this.as_ref() })