luaur-analyze-cli 0.1.3

Standalone Luau type-checker CLI (Rust).
Documentation
use crate::records::task_scheduler::{TaskQueue, TaskScheduler};
use alloc::sync::Arc;
use alloc::vec::Vec;

impl TaskScheduler {
    /// `TaskScheduler(unsigned threadCount)` (`CLI/src/Analyze.cpp:325-337`):
    /// spawns `threadCount` worker threads, each running `workerFunction()`.
    pub fn task_scheduler_task_scheduler(thread_count: u32) -> Self {
        let tasks = Arc::new(TaskQueue::new());
        let mut workers = Vec::with_capacity(thread_count as usize);

        for _ in 0..thread_count {
            let tasks = Arc::clone(&tasks);
            let handle = std::thread::spawn(move || {
                crate::methods::task_scheduler_worker_function::task_scheduler_worker_function(
                    &tasks,
                );
            });
            workers.push(handle);
        }

        TaskScheduler {
            thread_count,
            workers,
            tasks,
        }
    }
}