about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src/concurrency_limiter.rs
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-12-12 11:40:36 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-12-13 10:21:22 +0000
commitead78fdfdf6692b2ecef7f47dfc934011c51fe4c (patch)
tree3bf221ad8994bd04b02810c588562dc4b4352685 /compiler/rustc_codegen_cranelift/src/concurrency_limiter.rs
parent8e37e151835d96d6a7415e93e6876561485a3354 (diff)
downloadrust-ead78fdfdf6692b2ecef7f47dfc934011c51fe4c.tar.gz
rust-ead78fdfdf6692b2ecef7f47dfc934011c51fe4c.zip
Remove jobserver from Session
It is effectively a global resource and the jobserver::Client in Session
was a clone of GLOBAL_CLIENT anyway.
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src/concurrency_limiter.rs')
-rw-r--r--compiler/rustc_codegen_cranelift/src/concurrency_limiter.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/concurrency_limiter.rs b/compiler/rustc_codegen_cranelift/src/concurrency_limiter.rs
index 2093b49ff31..b5a81fc11d5 100644
--- a/compiler/rustc_codegen_cranelift/src/concurrency_limiter.rs
+++ b/compiler/rustc_codegen_cranelift/src/concurrency_limiter.rs
@@ -1,8 +1,7 @@
 use std::sync::{Arc, Condvar, Mutex};
 
-use jobserver::HelperThread;
+use rustc_data_structures::jobserver::{self, HelperThread};
 use rustc_errors::DiagCtxtHandle;
-use rustc_session::Session;
 
 // FIXME don't panic when a worker thread panics
 
@@ -14,14 +13,13 @@ pub(super) struct ConcurrencyLimiter {
 }
 
 impl ConcurrencyLimiter {
-    pub(super) fn new(sess: &Session, pending_jobs: usize) -> Self {
+    pub(super) fn new(pending_jobs: usize) -> Self {
         let state = Arc::new(Mutex::new(state::ConcurrencyLimiterState::new(pending_jobs)));
         let available_token_condvar = Arc::new(Condvar::new());
 
         let state_helper = state.clone();
         let available_token_condvar_helper = available_token_condvar.clone();
-        let helper_thread = sess
-            .jobserver
+        let helper_thread = jobserver::client()
             .clone()
             .into_helper_thread(move |token| {
                 let mut state = state_helper.lock().unwrap();
@@ -113,7 +111,7 @@ impl Drop for ConcurrencyLimiterToken {
 }
 
 mod state {
-    use jobserver::Acquired;
+    use rustc_data_structures::jobserver::Acquired;
 
     #[derive(Debug)]
     pub(super) struct ConcurrencyLimiterState {