Closed
Description
As demonstrated by the following program, which only prints hi
at the mercy of the OS scheduler (taking the 10_000
to 0
makes it never print, and making it large makes it always print, as one would expect).
#[feature(asm)];
extern mod native;
#[start]
fn start(argc: int, argv: **u8) -> int {
native::start(argc, argv, proc() {
spawn(proc() println("hi"));
for _ in range(0, 10_000) { unsafe {asm!("")} }
});
0
}
$ rustc -O native-spawn.rs
$ for i in {0..10}; do echo $i $(./native-spawn); done
0
1
2
3
4 hi
5 hi
6 hi
7 hi
8
9 hi
10 hi
Replacing libnative with libgreen prints every time, even with no busy loop.
Metadata
Metadata
Assignees
Labels
No labels