java_threadpool/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
mod ThreadPool_rs;
pub use ThreadPool_rs::ThreadPool;
pub use ThreadPool_rs::Future_rs::Future;


#[cfg(test)]
mod tests {
    use std::cell::RefCell;
    use std::sync::{LazyLock, Mutex};
    use super::*;
    static mut CORS_THREAD: LazyLock<Mutex<RefCell<usize>>> = std::sync::LazyLock::new(|| {
        return Mutex::new(RefCell::new(0));
    }
    );
    #[test]
    fn tests() {


        unsafe {

            let lock = (*CORS_THREAD).lock().unwrap();
            let mut thread_size = lock.borrow_mut();
            (*thread_size) = ((*thread_size) + 8);

            println!("{}", (*thread_size))

        }

        unsafe {

            let lock = (*CORS_THREAD).lock().unwrap();
            let mut thread_size = lock.borrow_mut();

            println!("{}", (*thread_size))

        }

    }
}