Add exec_new_thread

This commit is contained in:
Shunsuke Shibayama 2022-12-14 05:29:47 +09:00
parent fe7ce9d1b3
commit 0e928c758f
6 changed files with 31 additions and 58 deletions

View file

@ -3,9 +3,9 @@ extern crate erg_compiler;
extern crate erg_parser;
use std::process;
use std::thread;
use erg_common::config::ErgConfig;
use erg_common::spawn::exec_new_thread;
use erg_common::traits::Runnable;
use erg_compiler::build_hir::HIRBuilder;
@ -49,17 +49,5 @@ fn run() {
}
fn main() {
if cfg!(windows) {
const STACK_SIZE: usize = 4 * 1024 * 1024;
let child = thread::Builder::new()
.stack_size(STACK_SIZE)
.spawn(run)
.unwrap();
// Wait for thread to join
child.join().unwrap();
} else {
run();
}
exec_new_thread(run);
}