modified local to include an implementation for try_unsafe_borrow::<Task> so that the log methods will work
This commit is contained in:
parent
1d82fe5aea
commit
8e98eabce5
4 changed files with 17 additions and 10 deletions
|
|
@ -380,7 +380,7 @@ mod test {
|
|||
}
|
||||
|
||||
do spawntask {
|
||||
for max.times {
|
||||
do max.times {
|
||||
let mut stream = TcpStream::connect(addr);
|
||||
stream.write([99]);
|
||||
}
|
||||
|
|
@ -405,7 +405,7 @@ mod test {
|
|||
}
|
||||
|
||||
do spawntask {
|
||||
for max.times {
|
||||
do max.times {
|
||||
let mut stream = TcpStream::connect(addr);
|
||||
stream.write([99]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,13 @@ impl Local for Task {
|
|||
}
|
||||
}
|
||||
unsafe fn unsafe_borrow() -> *mut Task { local_ptr::unsafe_borrow() }
|
||||
unsafe fn try_unsafe_borrow() -> Option<*mut Task> { rtabort!("unimpl task try_unsafe_borrow") }
|
||||
unsafe fn try_unsafe_borrow() -> Option<*mut Task> {
|
||||
if Local::exists::<Task>() {
|
||||
Some(Local::unsafe_borrow())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Local for Scheduler {
|
||||
|
|
@ -95,7 +101,7 @@ impl Local for Scheduler {
|
|||
}
|
||||
}
|
||||
unsafe fn try_unsafe_borrow() -> Option<*mut Scheduler> {
|
||||
if Local::exists::<Task>() {
|
||||
if Local::exists::<Scheduler>() {
|
||||
Some(Local::unsafe_borrow())
|
||||
} else {
|
||||
None
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ impl Task {
|
|||
death: Death::new(),
|
||||
destroyed: false,
|
||||
coroutine: Some(Coroutine::empty()),
|
||||
name: None,
|
||||
sched: None,
|
||||
task_type: SchedTask
|
||||
}
|
||||
|
|
|
|||
|
|
@ -685,7 +685,7 @@ fn test_spawn_unlinked_unsup_no_fail_down() { // grandchild sends on a port
|
|||
let ch = ch.clone();
|
||||
do spawn_unlinked {
|
||||
// Give middle task a chance to fail-but-not-kill-us.
|
||||
for 16.times { task::yield(); }
|
||||
do 16.times { task::yield(); }
|
||||
ch.send(()); // If killed first, grandparent hangs.
|
||||
}
|
||||
fail!(); // Shouldn't kill either (grand)parent or (grand)child.
|
||||
|
|
@ -706,7 +706,7 @@ fn test_spawn_unlinked_sup_no_fail_up() { // child unlinked fails
|
|||
do run_in_newsched_task {
|
||||
do spawn_supervised { fail!(); }
|
||||
// Give child a chance to fail-but-not-kill-us.
|
||||
for 16.times { task::yield(); }
|
||||
do 16.times { task::yield(); }
|
||||
}
|
||||
}
|
||||
#[test] #[ignore(cfg(windows))]
|
||||
|
|
@ -808,7 +808,7 @@ fn test_spawn_failure_propagate_grandchild() {
|
|||
do spawn_supervised {
|
||||
do spawn_supervised { block_forever(); }
|
||||
}
|
||||
for 16.times { task::yield(); }
|
||||
do 16.times { task::yield(); }
|
||||
fail!();
|
||||
};
|
||||
assert!(result.is_err());
|
||||
|
|
@ -824,7 +824,7 @@ fn test_spawn_failure_propagate_secondborn() {
|
|||
do spawn_supervised {
|
||||
do spawn { block_forever(); } // linked
|
||||
}
|
||||
for 16.times { task::yield(); }
|
||||
do 16.times { task::yield(); }
|
||||
fail!();
|
||||
};
|
||||
assert!(result.is_err());
|
||||
|
|
@ -840,7 +840,7 @@ fn test_spawn_failure_propagate_nephew_or_niece() {
|
|||
do spawn { // linked
|
||||
do spawn_supervised { block_forever(); }
|
||||
}
|
||||
for 16.times { task::yield(); }
|
||||
do 16.times { task::yield(); }
|
||||
fail!();
|
||||
};
|
||||
assert!(result.is_err());
|
||||
|
|
@ -856,7 +856,7 @@ fn test_spawn_linked_sup_propagate_sibling() {
|
|||
do spawn { // linked
|
||||
do spawn { block_forever(); } // linked
|
||||
}
|
||||
for 16.times { task::yield(); }
|
||||
do 16.times { task::yield(); }
|
||||
fail!();
|
||||
};
|
||||
assert!(result.is_err());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue