Cleanup cfg check handling in expression store lowering

This commit is contained in:
Lukas Wirth 2025-04-29 10:49:41 +02:00
parent 7d9b839f9c
commit d11dbf648f
17 changed files with 234 additions and 188 deletions

View file

@ -26,12 +26,12 @@ pub use pool::Pool;
/// # Panics
///
/// Panics if failed to spawn the thread.
pub fn spawn<F, T>(intent: ThreadIntent, f: F) -> JoinHandle<T>
pub fn spawn<F, T>(intent: ThreadIntent, name: String, f: F) -> JoinHandle<T>
where
F: (FnOnce() -> T) + Send + 'static,
T: Send + 'static,
{
Builder::new(intent).spawn(f).expect("failed to spawn thread")
Builder::new(intent, name).spawn(f).expect("failed to spawn thread")
}
pub struct Builder {
@ -42,13 +42,8 @@ pub struct Builder {
impl Builder {
#[must_use]
pub fn new(intent: ThreadIntent) -> Self {
Self { intent, inner: jod_thread::Builder::new(), allow_leak: false }
}
#[must_use]
pub fn name(self, name: String) -> Self {
Self { inner: self.inner.name(name), ..self }
pub fn new(intent: ThreadIntent, name: impl Into<String>) -> Self {
Self { intent, inner: jod_thread::Builder::new().name(name.into()), allow_leak: false }
}
#[must_use]

View file

@ -50,10 +50,9 @@ impl Pool {
let extant_tasks = Arc::new(AtomicUsize::new(0));
let mut handles = Vec::with_capacity(threads);
for _ in 0..threads {
let handle = Builder::new(INITIAL_INTENT)
for idx in 0..threads {
let handle = Builder::new(INITIAL_INTENT, format!("Worker{idx}",))
.stack_size(STACK_SIZE)
.name("Worker".into())
.allow_leak(true)
.spawn({
let extant_tasks = Arc::clone(&extant_tasks);