-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
106: avoid deadlock when multiple cores are available r=jbreitbart a=stlankes - PR should solve issues #105 - add integration test to show this behavior - make sure that the task is always added to the list of blocked task => avoid "loosing" of tasks Co-authored-by: Stefan Lankes <[email protected]>
- Loading branch information
Showing
7 changed files
with
82 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#![feature(test)] | ||
#![no_std] | ||
#![no_main] | ||
#![test_runner(common::test_case_runner)] | ||
#![feature(custom_test_frameworks)] | ||
#![reexport_test_harness_main = "test_main"] | ||
|
||
extern crate hermit; | ||
|
||
#[macro_use] | ||
use common::*; | ||
mod common; | ||
|
||
#[macro_use] | ||
use alloc::vec; | ||
use hermit::{sys_join, sys_spawn2, sys_usleep, USER_STACK_SIZE}; | ||
|
||
const NORMAL_PRIO: u8 = 2; | ||
|
||
extern "C" fn thread_func(i: usize) { | ||
println!("this is thread number {}", i); | ||
sys_usleep(2000000); | ||
println!("---------------THREAD DONE!---------- {}", i); | ||
} | ||
|
||
#[test_case] | ||
pub fn thread_test() { | ||
let mut children = vec![]; | ||
|
||
let threadnum = 5; | ||
for i in 0..threadnum { | ||
println!("SPAWNING THREAD {}", i); | ||
let id = sys_spawn2(thread_func, i, NORMAL_PRIO, USER_STACK_SIZE, -1); | ||
children.push(id); | ||
} | ||
println!("SPAWNED THREADS"); | ||
|
||
for child in children { | ||
sys_join(child); | ||
} | ||
} | ||
|
||
#[no_mangle] | ||
extern "C" fn runtime_entry(_argc: i32, _argv: *const *const u8, _env: *const *const u8) -> ! { | ||
test_main(); | ||
common::exit(false) | ||
} |