mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-03 18:29:00 +00:00
chore: name the spawned thread
This commit is contained in:
parent
0079aed860
commit
8bb91cfe11
6 changed files with 8 additions and 7 deletions
|
@ -15,7 +15,7 @@ macro_rules! enable_overflow_stacktrace {
|
|||
/// Execute a function in a new thread on Windows, otherwise just run it.
|
||||
///
|
||||
/// Windows has a smaller default stack size than other OSs, which may cause a stack overflow, especially in the parsing process.
|
||||
pub fn exec_new_thread<F, T>(run: F) -> T
|
||||
pub fn exec_new_thread<F, T>(run: F, name: &str) -> T
|
||||
where
|
||||
F: FnOnce() -> T + Send + 'static,
|
||||
T: Send + 'static,
|
||||
|
@ -24,6 +24,7 @@ where
|
|||
if cfg!(windows) || cfg!(feature = "large_thread") {
|
||||
const STACK_SIZE: usize = 4 * 1024 * 1024;
|
||||
let child = thread::Builder::new()
|
||||
.name(name.to_string())
|
||||
.stack_size(STACK_SIZE)
|
||||
.spawn(run)
|
||||
.unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue