diff options
| author | Stefan Lankes <slankes@eonerc.rwth-aachen.de> | 2020-04-26 19:07:13 +0200 |
|---|---|---|
| committer | Stefan Lankes <slankes@eonerc.rwth-aachen.de> | 2020-04-26 19:47:46 +0200 |
| commit | 4d3cf5bd9b6c48e5116fb8d9747a7a2dbde09d1d (patch) | |
| tree | ab2300eb90b6fb04c2523a5adfc894af273cc18c /src/libstd/sys | |
| parent | ec1f28f9614292c36b371d3758afffdd52cb9786 (diff) | |
| download | rust-4d3cf5bd9b6c48e5116fb8d9747a7a2dbde09d1d.tar.gz rust-4d3cf5bd9b6c48e5116fb8d9747a7a2dbde09d1d.zip | |
use new interface to create threads on HermitCore
- the new interface allows to define the stack size
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/hermit/thread.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/libstd/sys/hermit/thread.rs b/src/libstd/sys/hermit/thread.rs index 7e3fb4c6d20..55924ee0e68 100644 --- a/src/libstd/sys/hermit/thread.rs +++ b/src/libstd/sys/hermit/thread.rs @@ -16,25 +16,24 @@ pub struct Thread { unsafe impl Send for Thread {} unsafe impl Sync for Thread {} -pub const DEFAULT_MIN_STACK_SIZE: usize = 262144; +pub const DEFAULT_MIN_STACK_SIZE: usize = 1_048_576; impl Thread { pub unsafe fn new_with_coreid( - _stack: usize, + stack: usize, p: Box<dyn FnOnce()>, core_id: isize, ) -> io::Result<Thread> { let p = Box::into_raw(box p); - let mut tid: Tid = u32::MAX; - let ret = abi::spawn( - &mut tid as *mut Tid, + let tid = abi::spawn2( thread_start, - &*p as *const _ as *const u8 as usize, + p as usize, abi::Priority::into(abi::NORMAL_PRIO), + stack, core_id, ); - return if ret != 0 { + return if tid == 0 { // The thread failed to start and as a result p was not consumed. Therefore, it is // safe to reconstruct the box so that it gets deallocated. drop(Box::from_raw(p)); |
