auto merge of #7831 : ozten/rust/issues-7764-swap_unwarp-take-unwrap, r=pcwalton
Fixes Issue #7764 Running `make check` I do get a failure: test rt::io::extensions::test::push_bytes ... ok rustest rt::comm::test::oneshot_single_thread_send_port_close ... t: task failed at 'Unhandled condition: read_error: {kind: OtherIoError, desc: "Placeholder error. You shouldn\'t be seeing this", detail: None}', /Users/shout/Projects/rust/src/libstd/condition.rs:50 /bin/sh: line 1: 35056 Abort trap: 6 x86_64-apple-darwin/stage2/test/stdtest-x86_64-apple-darwin --logfile tmp/check-stage2-T-x86_64-apple-darwin-H-x86_64-apple-darwin-std.log make: *** [tmp/check-stage2-T-x86_64-apple-darwin-H-x86_64-apple-darwin-std.ok] Error 134
This commit is contained in:
commit
4bd716ac8e
|
@ -173,11 +173,11 @@ impl<T> Deque<T> for DList<T> {
|
||||||
let tail_own = match tail.prev.resolve() {
|
let tail_own = match tail.prev.resolve() {
|
||||||
None => {
|
None => {
|
||||||
self.list_tail = Rawlink::none();
|
self.list_tail = Rawlink::none();
|
||||||
self.list_head.swap_unwrap()
|
self.list_head.take_unwrap()
|
||||||
},
|
},
|
||||||
Some(tail_prev) => {
|
Some(tail_prev) => {
|
||||||
self.list_tail = tail.prev;
|
self.list_tail = tail.prev;
|
||||||
tail_prev.next.swap_unwrap()
|
tail_prev.next.take_unwrap()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Some(tail_own.value)
|
Some(tail_own.value)
|
||||||
|
@ -465,7 +465,7 @@ impl<'self, A> ListInsertion<A> for MutDListIterator<'self, A> {
|
||||||
Some(prev) => prev,
|
Some(prev) => prev,
|
||||||
};
|
};
|
||||||
let mut ins_node = ~Node{value: elt, next: None, prev: Rawlink::none()};
|
let mut ins_node = ~Node{value: elt, next: None, prev: Rawlink::none()};
|
||||||
let node_own = prev_node.next.swap_unwrap();
|
let node_own = prev_node.next.take_unwrap();
|
||||||
ins_node.next = link_with_prev(node_own, Rawlink::some(ins_node));
|
ins_node.next = link_with_prev(node_own, Rawlink::some(ins_node));
|
||||||
prev_node.next = link_with_prev(ins_node, Rawlink::some(prev_node));
|
prev_node.next = link_with_prev(ins_node, Rawlink::some(prev_node));
|
||||||
self.list.length += 1;
|
self.list.length += 1;
|
||||||
|
|
|
@ -116,7 +116,7 @@ pub fn get_addr(node: &str, iotask: &iotask)
|
||||||
let (output_po, output_ch) = stream();
|
let (output_po, output_ch) = stream();
|
||||||
let mut output_ch = Some(SharedChan::new(output_ch));
|
let mut output_ch = Some(SharedChan::new(output_ch));
|
||||||
do str::as_buf(node) |node_ptr, len| {
|
do str::as_buf(node) |node_ptr, len| {
|
||||||
let output_ch = output_ch.swap_unwrap();
|
let output_ch = output_ch.take_unwrap();
|
||||||
debug!("slice len %?", len);
|
debug!("slice len %?", len);
|
||||||
let handle = create_uv_getaddrinfo_t();
|
let handle = create_uv_getaddrinfo_t();
|
||||||
let handle_ptr: *uv_getaddrinfo_t = &handle;
|
let handle_ptr: *uv_getaddrinfo_t = &handle;
|
||||||
|
|
|
@ -260,7 +260,7 @@ impl<'self> Condvar<'self> {
|
||||||
signal_waitqueue(&state.waiters);
|
signal_waitqueue(&state.waiters);
|
||||||
}
|
}
|
||||||
// Enqueue ourself to be woken up by a signaller.
|
// Enqueue ourself to be woken up by a signaller.
|
||||||
let SignalEnd = SignalEnd.swap_unwrap();
|
let SignalEnd = SignalEnd.take_unwrap();
|
||||||
state.blocked[condvar_id].tail.send(SignalEnd);
|
state.blocked[condvar_id].tail.send(SignalEnd);
|
||||||
} else {
|
} else {
|
||||||
out_of_bounds = Some(state.blocked.len());
|
out_of_bounds = Some(state.blocked.len());
|
||||||
|
@ -281,7 +281,7 @@ impl<'self> Condvar<'self> {
|
||||||
// Unconditionally "block". (Might not actually block if a
|
// Unconditionally "block". (Might not actually block if a
|
||||||
// signaller already sent -- I mean 'unconditionally' in contrast
|
// signaller already sent -- I mean 'unconditionally' in contrast
|
||||||
// with acquire().)
|
// with acquire().)
|
||||||
let _ = comm::recv_one(WaitEnd.swap_unwrap());
|
let _ = comm::recv_one(WaitEnd.take_unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is needed for a failing condition variable to reacquire the
|
// This is needed for a failing condition variable to reacquire the
|
||||||
|
@ -353,7 +353,7 @@ impl<'self> Condvar<'self> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
do check_cvar_bounds(out_of_bounds, condvar_id, "cond.signal_on()") {
|
do check_cvar_bounds(out_of_bounds, condvar_id, "cond.signal_on()") {
|
||||||
let queue = queue.swap_unwrap();
|
let queue = queue.take_unwrap();
|
||||||
broadcast_waitqueue(&queue)
|
broadcast_waitqueue(&queue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1436,7 +1436,7 @@ mod tests {
|
||||||
do x.write_downgrade |xwrite| {
|
do x.write_downgrade |xwrite| {
|
||||||
let mut xopt = Some(xwrite);
|
let mut xopt = Some(xwrite);
|
||||||
do y.write_downgrade |_ywrite| {
|
do y.write_downgrade |_ywrite| {
|
||||||
y.downgrade(xopt.swap_unwrap());
|
y.downgrade(xopt.take_unwrap());
|
||||||
error!("oops, y.downgrade(x) should have failed!");
|
error!("oops, y.downgrade(x) should have failed!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -552,7 +552,7 @@ fn mutate_values<'r, K: TotalOrd, V>(node: &'r mut Option<~TreeNode<K, V>>,
|
||||||
// Remove left horizontal link by rotating right
|
// Remove left horizontal link by rotating right
|
||||||
fn skew<K: TotalOrd, V>(node: &mut ~TreeNode<K, V>) {
|
fn skew<K: TotalOrd, V>(node: &mut ~TreeNode<K, V>) {
|
||||||
if node.left.map_default(false, |x| x.level == node.level) {
|
if node.left.map_default(false, |x| x.level == node.level) {
|
||||||
let mut save = node.left.swap_unwrap();
|
let mut save = node.left.take_unwrap();
|
||||||
swap(&mut node.left, &mut save.right); // save.right now None
|
swap(&mut node.left, &mut save.right); // save.right now None
|
||||||
swap(node, &mut save);
|
swap(node, &mut save);
|
||||||
node.right = Some(save);
|
node.right = Some(save);
|
||||||
|
@ -564,7 +564,7 @@ fn skew<K: TotalOrd, V>(node: &mut ~TreeNode<K, V>) {
|
||||||
fn split<K: TotalOrd, V>(node: &mut ~TreeNode<K, V>) {
|
fn split<K: TotalOrd, V>(node: &mut ~TreeNode<K, V>) {
|
||||||
if node.right.map_default(false,
|
if node.right.map_default(false,
|
||||||
|x| x.right.map_default(false, |y| y.level == node.level)) {
|
|x| x.right.map_default(false, |y| y.level == node.level)) {
|
||||||
let mut save = node.right.swap_unwrap();
|
let mut save = node.right.take_unwrap();
|
||||||
swap(&mut node.right, &mut save.left); // save.left now None
|
swap(&mut node.right, &mut save.left); // save.left now None
|
||||||
save.level += 1;
|
save.level += 1;
|
||||||
swap(node, &mut save);
|
swap(node, &mut save);
|
||||||
|
@ -643,7 +643,7 @@ fn remove<K: TotalOrd, V>(node: &mut Option<~TreeNode<K, V>>,
|
||||||
Equal => {
|
Equal => {
|
||||||
if save.left.is_some() {
|
if save.left.is_some() {
|
||||||
if save.right.is_some() {
|
if save.right.is_some() {
|
||||||
let mut left = save.left.swap_unwrap();
|
let mut left = save.left.take_unwrap();
|
||||||
if left.right.is_some() {
|
if left.right.is_some() {
|
||||||
heir_swap(save, &mut left.right);
|
heir_swap(save, &mut left.right);
|
||||||
} else {
|
} else {
|
||||||
|
@ -653,13 +653,13 @@ fn remove<K: TotalOrd, V>(node: &mut Option<~TreeNode<K, V>>,
|
||||||
save.left = Some(left);
|
save.left = Some(left);
|
||||||
(remove(&mut save.left, key), true)
|
(remove(&mut save.left, key), true)
|
||||||
} else {
|
} else {
|
||||||
let new = save.left.swap_unwrap();
|
let new = save.left.take_unwrap();
|
||||||
let ~TreeNode{value, _} = replace(save, new);
|
let ~TreeNode{value, _} = replace(save, new);
|
||||||
*save = save.left.swap_unwrap();
|
*save = save.left.take_unwrap();
|
||||||
(Some(value), true)
|
(Some(value), true)
|
||||||
}
|
}
|
||||||
} else if save.right.is_some() {
|
} else if save.right.is_some() {
|
||||||
let new = save.right.swap_unwrap();
|
let new = save.right.take_unwrap();
|
||||||
let ~TreeNode{value, _} = replace(save, new);
|
let ~TreeNode{value, _} = replace(save, new);
|
||||||
(Some(value), true)
|
(Some(value), true)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -203,14 +203,14 @@ impl<T> Option<T> {
|
||||||
/// Apply a function to the contained value or do nothing
|
/// Apply a function to the contained value or do nothing
|
||||||
pub fn mutate(&mut self, f: &fn(T) -> T) {
|
pub fn mutate(&mut self, f: &fn(T) -> T) {
|
||||||
if self.is_some() {
|
if self.is_some() {
|
||||||
*self = Some(f(self.swap_unwrap()));
|
*self = Some(f(self.take_unwrap()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Apply a function to the contained value or set it to a default
|
/// Apply a function to the contained value or set it to a default
|
||||||
pub fn mutate_default(&mut self, def: T, f: &fn(T) -> T) {
|
pub fn mutate_default(&mut self, def: T, f: &fn(T) -> T) {
|
||||||
if self.is_some() {
|
if self.is_some() {
|
||||||
*self = Some(f(self.swap_unwrap()));
|
*self = Some(f(self.take_unwrap()));
|
||||||
} else {
|
} else {
|
||||||
*self = Some(def);
|
*self = Some(def);
|
||||||
}
|
}
|
||||||
|
@ -293,8 +293,8 @@ impl<T> Option<T> {
|
||||||
* Fails if the value equals `None`.
|
* Fails if the value equals `None`.
|
||||||
*/
|
*/
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn swap_unwrap(&mut self) -> T {
|
pub fn take_unwrap(&mut self) -> T {
|
||||||
if self.is_none() { fail!("option::swap_unwrap none") }
|
if self.is_none() { fail!("option::take_unwrap none") }
|
||||||
util::replace(self, None).unwrap()
|
util::replace(self, None).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,7 +460,7 @@ fn test_option_dance() {
|
||||||
let mut y = Some(5);
|
let mut y = Some(5);
|
||||||
let mut y2 = 0;
|
let mut y2 = 0;
|
||||||
for x.iter().advance |_x| {
|
for x.iter().advance |_x| {
|
||||||
y2 = y.swap_unwrap();
|
y2 = y.take_unwrap();
|
||||||
}
|
}
|
||||||
assert_eq!(y2, 5);
|
assert_eq!(y2, 5);
|
||||||
assert!(y.is_none());
|
assert!(y.is_none());
|
||||||
|
@ -468,8 +468,8 @@ fn test_option_dance() {
|
||||||
#[test] #[should_fail] #[ignore(cfg(windows))]
|
#[test] #[should_fail] #[ignore(cfg(windows))]
|
||||||
fn test_option_too_much_dance() {
|
fn test_option_too_much_dance() {
|
||||||
let mut y = Some(util::NonCopyable);
|
let mut y = Some(util::NonCopyable);
|
||||||
let _y2 = y.swap_unwrap();
|
let _y2 = y.take_unwrap();
|
||||||
let _y3 = y.swap_unwrap();
|
let _y3 = y.take_unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -328,7 +328,7 @@ impl Scheduler {
|
||||||
/// Given an input Coroutine sends it back to its home scheduler.
|
/// Given an input Coroutine sends it back to its home scheduler.
|
||||||
fn send_task_home(task: ~Task) {
|
fn send_task_home(task: ~Task) {
|
||||||
let mut task = task;
|
let mut task = task;
|
||||||
let mut home = task.home.swap_unwrap();
|
let mut home = task.home.take_unwrap();
|
||||||
match home {
|
match home {
|
||||||
Sched(ref mut home_handle) => {
|
Sched(ref mut home_handle) => {
|
||||||
home_handle.send(PinnedTask(task));
|
home_handle.send(PinnedTask(task));
|
||||||
|
@ -418,7 +418,7 @@ impl Scheduler {
|
||||||
|
|
||||||
do self.deschedule_running_task_and_then |sched, dead_task| {
|
do self.deschedule_running_task_and_then |sched, dead_task| {
|
||||||
let mut dead_task = dead_task;
|
let mut dead_task = dead_task;
|
||||||
let coroutine = dead_task.coroutine.swap_unwrap();
|
let coroutine = dead_task.coroutine.take_unwrap();
|
||||||
coroutine.recycle(&mut sched.stack_pool);
|
coroutine.recycle(&mut sched.stack_pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ impl Scheduler {
|
||||||
this.metrics.context_switches_task_to_sched += 1;
|
this.metrics.context_switches_task_to_sched += 1;
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let blocked_task = this.current_task.swap_unwrap();
|
let blocked_task = this.current_task.take_unwrap();
|
||||||
let f_fake_region = transmute::<&fn(&mut Scheduler, ~Task),
|
let f_fake_region = transmute::<&fn(&mut Scheduler, ~Task),
|
||||||
&fn(&mut Scheduler, ~Task)>(f);
|
&fn(&mut Scheduler, ~Task)>(f);
|
||||||
let f_opaque = ClosureConverter::from_fn(f_fake_region);
|
let f_opaque = ClosureConverter::from_fn(f_fake_region);
|
||||||
|
@ -538,7 +538,7 @@ impl Scheduler {
|
||||||
rtdebug!("switching tasks");
|
rtdebug!("switching tasks");
|
||||||
this.metrics.context_switches_task_to_task += 1;
|
this.metrics.context_switches_task_to_task += 1;
|
||||||
|
|
||||||
let old_running_task = this.current_task.swap_unwrap();
|
let old_running_task = this.current_task.take_unwrap();
|
||||||
let f_fake_region = unsafe {
|
let f_fake_region = unsafe {
|
||||||
transmute::<&fn(&mut Scheduler, ~Task),
|
transmute::<&fn(&mut Scheduler, ~Task),
|
||||||
&fn(&mut Scheduler, ~Task)>(f)
|
&fn(&mut Scheduler, ~Task)>(f)
|
||||||
|
@ -576,7 +576,7 @@ impl Scheduler {
|
||||||
|
|
||||||
assert!(self.cleanup_job.is_some());
|
assert!(self.cleanup_job.is_some());
|
||||||
|
|
||||||
let cleanup_job = self.cleanup_job.swap_unwrap();
|
let cleanup_job = self.cleanup_job.take_unwrap();
|
||||||
match cleanup_job {
|
match cleanup_job {
|
||||||
DoNothing => { }
|
DoNothing => { }
|
||||||
GiveTask(task, f) => (f.to_fn())(self, task)
|
GiveTask(task, f) => (f.to_fn())(self, task)
|
||||||
|
|
|
@ -127,7 +127,7 @@ impl Task {
|
||||||
|
|
||||||
// Wait for children. Possibly report the exit status.
|
// Wait for children. Possibly report the exit status.
|
||||||
let local_success = !self.unwinder.unwinding;
|
let local_success = !self.unwinder.unwinding;
|
||||||
let join_latch = self.join_latch.swap_unwrap();
|
let join_latch = self.join_latch.take_unwrap();
|
||||||
match self.on_exit {
|
match self.on_exit {
|
||||||
Some(ref on_exit) => {
|
Some(ref on_exit) => {
|
||||||
let success = join_latch.wait(local_success);
|
let success = join_latch.wait(local_success);
|
||||||
|
|
|
@ -53,7 +53,7 @@ impl<T> Tube<T> {
|
||||||
if (*state).blocked_task.is_some() {
|
if (*state).blocked_task.is_some() {
|
||||||
// There's a waiting task. Wake it up
|
// There's a waiting task. Wake it up
|
||||||
rtdebug!("waking blocked tube");
|
rtdebug!("waking blocked tube");
|
||||||
let task = (*state).blocked_task.swap_unwrap();
|
let task = (*state).blocked_task.take_unwrap();
|
||||||
let sched = Local::take::<Scheduler>();
|
let sched = Local::take::<Scheduler>();
|
||||||
sched.resume_task_immediately(task);
|
sched.resume_task_immediately(task);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ impl AsyncWatcher {
|
||||||
let mut watcher: AsyncWatcher = NativeHandle::from_native_handle(handle);
|
let mut watcher: AsyncWatcher = NativeHandle::from_native_handle(handle);
|
||||||
{
|
{
|
||||||
let data = watcher.get_watcher_data();
|
let data = watcher.get_watcher_data();
|
||||||
data.close_cb.swap_unwrap()();
|
data.close_cb.take_unwrap()();
|
||||||
}
|
}
|
||||||
watcher.drop_watcher_data();
|
watcher.drop_watcher_data();
|
||||||
unsafe { uvll::free_handle(handle as *c_void); }
|
unsafe { uvll::free_handle(handle as *c_void); }
|
||||||
|
|
|
@ -73,7 +73,7 @@ impl IdleWatcher {
|
||||||
let mut idle_watcher: IdleWatcher = NativeHandle::from_native_handle(handle);
|
let mut idle_watcher: IdleWatcher = NativeHandle::from_native_handle(handle);
|
||||||
{
|
{
|
||||||
let data = idle_watcher.get_watcher_data();
|
let data = idle_watcher.get_watcher_data();
|
||||||
data.close_cb.swap_unwrap()();
|
data.close_cb.take_unwrap()();
|
||||||
}
|
}
|
||||||
idle_watcher.drop_watcher_data();
|
idle_watcher.drop_watcher_data();
|
||||||
uvll::idle_delete(handle);
|
uvll::idle_delete(handle);
|
||||||
|
|
|
@ -209,7 +209,7 @@ impl StreamWatcher {
|
||||||
let write_request: WriteRequest = NativeHandle::from_native_handle(req);
|
let write_request: WriteRequest = NativeHandle::from_native_handle(req);
|
||||||
let mut stream_watcher = write_request.stream();
|
let mut stream_watcher = write_request.stream();
|
||||||
write_request.delete();
|
write_request.delete();
|
||||||
let cb = stream_watcher.get_watcher_data().write_cb.swap_unwrap();
|
let cb = stream_watcher.get_watcher_data().write_cb.take_unwrap();
|
||||||
let status = status_to_maybe_uv_error(stream_watcher.native_handle(), status);
|
let status = status_to_maybe_uv_error(stream_watcher.native_handle(), status);
|
||||||
cb(stream_watcher, status);
|
cb(stream_watcher, status);
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ impl StreamWatcher {
|
||||||
|
|
||||||
extern fn close_cb(handle: *uvll::uv_stream_t) {
|
extern fn close_cb(handle: *uvll::uv_stream_t) {
|
||||||
let mut stream_watcher: StreamWatcher = NativeHandle::from_native_handle(handle);
|
let mut stream_watcher: StreamWatcher = NativeHandle::from_native_handle(handle);
|
||||||
stream_watcher.get_watcher_data().close_cb.swap_unwrap()();
|
stream_watcher.get_watcher_data().close_cb.take_unwrap()();
|
||||||
stream_watcher.drop_watcher_data();
|
stream_watcher.drop_watcher_data();
|
||||||
unsafe { free_handle(handle as *c_void) }
|
unsafe { free_handle(handle as *c_void) }
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ impl TcpWatcher {
|
||||||
let connect_request: ConnectRequest = NativeHandle::from_native_handle(req);
|
let connect_request: ConnectRequest = NativeHandle::from_native_handle(req);
|
||||||
let mut stream_watcher = connect_request.stream();
|
let mut stream_watcher = connect_request.stream();
|
||||||
connect_request.delete();
|
connect_request.delete();
|
||||||
let cb = stream_watcher.get_watcher_data().connect_cb.swap_unwrap();
|
let cb = stream_watcher.get_watcher_data().connect_cb.take_unwrap();
|
||||||
let status = status_to_maybe_uv_error(stream_watcher.native_handle(), status);
|
let status = status_to_maybe_uv_error(stream_watcher.native_handle(), status);
|
||||||
cb(stream_watcher, status);
|
cb(stream_watcher, status);
|
||||||
}
|
}
|
||||||
|
@ -438,7 +438,7 @@ impl UdpWatcher {
|
||||||
let send_request: UdpSendRequest = NativeHandle::from_native_handle(req);
|
let send_request: UdpSendRequest = NativeHandle::from_native_handle(req);
|
||||||
let mut udp_watcher = send_request.handle();
|
let mut udp_watcher = send_request.handle();
|
||||||
send_request.delete();
|
send_request.delete();
|
||||||
let cb = udp_watcher.get_watcher_data().udp_send_cb.swap_unwrap();
|
let cb = udp_watcher.get_watcher_data().udp_send_cb.take_unwrap();
|
||||||
let status = status_to_maybe_uv_error(udp_watcher.native_handle(), status);
|
let status = status_to_maybe_uv_error(udp_watcher.native_handle(), status);
|
||||||
cb(udp_watcher, status);
|
cb(udp_watcher, status);
|
||||||
}
|
}
|
||||||
|
@ -456,7 +456,7 @@ impl UdpWatcher {
|
||||||
|
|
||||||
extern fn close_cb(handle: *uvll::uv_udp_t) {
|
extern fn close_cb(handle: *uvll::uv_udp_t) {
|
||||||
let mut udp_watcher: UdpWatcher = NativeHandle::from_native_handle(handle);
|
let mut udp_watcher: UdpWatcher = NativeHandle::from_native_handle(handle);
|
||||||
udp_watcher.get_watcher_data().close_cb.swap_unwrap()();
|
udp_watcher.get_watcher_data().close_cb.take_unwrap()();
|
||||||
udp_watcher.drop_watcher_data();
|
udp_watcher.drop_watcher_data();
|
||||||
unsafe { free_handle(handle as *c_void) }
|
unsafe { free_handle(handle as *c_void) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ impl TimerWatcher {
|
||||||
let mut watcher: TimerWatcher = NativeHandle::from_native_handle(handle);
|
let mut watcher: TimerWatcher = NativeHandle::from_native_handle(handle);
|
||||||
{
|
{
|
||||||
let data = watcher.get_watcher_data();
|
let data = watcher.get_watcher_data();
|
||||||
data.close_cb.swap_unwrap()();
|
data.close_cb.take_unwrap()();
|
||||||
}
|
}
|
||||||
watcher.drop_watcher_data();
|
watcher.drop_watcher_data();
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -302,7 +302,7 @@ fn each_ancestor(list: &mut AncestorList,
|
||||||
fn with_parent_tg<U>(parent_group: &mut Option<TaskGroupArc>,
|
fn with_parent_tg<U>(parent_group: &mut Option<TaskGroupArc>,
|
||||||
blk: &fn(TaskGroupInner) -> U) -> U {
|
blk: &fn(TaskGroupInner) -> U) -> U {
|
||||||
// If this trips, more likely the problem is 'blk' failed inside.
|
// If this trips, more likely the problem is 'blk' failed inside.
|
||||||
let tmp_arc = parent_group.swap_unwrap();
|
let tmp_arc = parent_group.take_unwrap();
|
||||||
let result = do access_group(&tmp_arc) |tg_opt| { blk(tg_opt) };
|
let result = do access_group(&tmp_arc) |tg_opt| { blk(tg_opt) };
|
||||||
*parent_group = Some(tmp_arc);
|
*parent_group = Some(tmp_arc);
|
||||||
result
|
result
|
||||||
|
@ -609,7 +609,7 @@ fn spawn_raw_newsched(mut opts: TaskOpts, f: ~fn()) {
|
||||||
};
|
};
|
||||||
|
|
||||||
if opts.notify_chan.is_some() {
|
if opts.notify_chan.is_some() {
|
||||||
let notify_chan = opts.notify_chan.swap_unwrap();
|
let notify_chan = opts.notify_chan.take_unwrap();
|
||||||
let notify_chan = Cell::new(notify_chan);
|
let notify_chan = Cell::new(notify_chan);
|
||||||
let on_exit: ~fn(bool) = |success| {
|
let on_exit: ~fn(bool) = |success| {
|
||||||
notify_chan.take().send(
|
notify_chan.take().send(
|
||||||
|
@ -647,7 +647,7 @@ fn spawn_raw_oldsched(mut opts: TaskOpts, f: ~fn()) {
|
||||||
let notify_chan = if opts.notify_chan.is_none() {
|
let notify_chan = if opts.notify_chan.is_none() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(opts.notify_chan.swap_unwrap())
|
Some(opts.notify_chan.take_unwrap())
|
||||||
};
|
};
|
||||||
|
|
||||||
let child_wrapper = make_child_wrapper(new_task, child_tg,
|
let child_wrapper = make_child_wrapper(new_task, child_tg,
|
||||||
|
|
|
@ -60,8 +60,8 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
|
||||||
// Send/Receive lots of messages.
|
// Send/Receive lots of messages.
|
||||||
for uint::range(0u, count) |j| {
|
for uint::range(0u, count) |j| {
|
||||||
//error!("task %?, iter %?", i, j);
|
//error!("task %?, iter %?", i, j);
|
||||||
let mut num_chan2 = num_chan.swap_unwrap();
|
let mut num_chan2 = num_chan.take_unwrap();
|
||||||
let mut num_port2 = num_port.swap_unwrap();
|
let mut num_port2 = num_port.take_unwrap();
|
||||||
send(&num_chan2, i * j);
|
send(&num_chan2, i * j);
|
||||||
num_chan = Some(num_chan2);
|
num_chan = Some(num_chan2);
|
||||||
let _n = recv(&num_port2);
|
let _n = recv(&num_port2);
|
||||||
|
|
|
@ -56,8 +56,8 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
|
||||||
// Send/Receive lots of messages.
|
// Send/Receive lots of messages.
|
||||||
for uint::range(0u, count) |j| {
|
for uint::range(0u, count) |j| {
|
||||||
//error!("task %?, iter %?", i, j);
|
//error!("task %?, iter %?", i, j);
|
||||||
let mut num_chan2 = num_chan.swap_unwrap();
|
let mut num_chan2 = num_chan.take_unwrap();
|
||||||
let mut num_port2 = num_port.swap_unwrap();
|
let mut num_port2 = num_port.take_unwrap();
|
||||||
send(&num_chan2, i * j);
|
send(&num_chan2, i * j);
|
||||||
num_chan = Some(num_chan2);
|
num_chan = Some(num_chan2);
|
||||||
let _n = recv(&num_port2);
|
let _n = recv(&num_port2);
|
||||||
|
|
Loading…
Reference in New Issue