parent
f84b7291e7
commit
d7f97e3018
7 changed files with 13 additions and 13 deletions
|
@ -47,7 +47,7 @@ use sync::{Mutex, RWLock};
|
||||||
use std::cast;
|
use std::cast;
|
||||||
use std::sync::arc::UnsafeArc;
|
use std::sync::arc::UnsafeArc;
|
||||||
use std::task;
|
use std::task;
|
||||||
use std::borrow;
|
use std::reference;
|
||||||
|
|
||||||
/// As sync::condvar, a mechanism for unlock-and-descheduling and signaling.
|
/// As sync::condvar, a mechanism for unlock-and-descheduling and signaling.
|
||||||
pub struct Condvar<'a> {
|
pub struct Condvar<'a> {
|
||||||
|
@ -465,7 +465,7 @@ impl<T:Freeze + Send> RWArc<T> {
|
||||||
// of this cast is removing the mutability.)
|
// of this cast is removing the mutability.)
|
||||||
let new_data = data;
|
let new_data = data;
|
||||||
// Downgrade ensured the token belonged to us. Just a sanity check.
|
// Downgrade ensured the token belonged to us. Just a sanity check.
|
||||||
assert!(borrow::ref_eq(&(*state).data, new_data));
|
assert!(reference::ref_eq(&(*state).data, new_data));
|
||||||
// Produce new token
|
// Produce new token
|
||||||
RWReadMode {
|
RWReadMode {
|
||||||
data: new_data,
|
data: new_data,
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
use std::borrow;
|
use std::reference;
|
||||||
use std::comm;
|
use std::comm;
|
||||||
use std::unstable::sync::Exclusive;
|
use std::unstable::sync::Exclusive;
|
||||||
use std::sync::arc::UnsafeArc;
|
use std::sync::arc::UnsafeArc;
|
||||||
|
@ -634,7 +634,7 @@ impl RWLock {
|
||||||
/// To be called inside of the write_downgrade block.
|
/// To be called inside of the write_downgrade block.
|
||||||
pub fn downgrade<'a>(&self, token: RWLockWriteMode<'a>)
|
pub fn downgrade<'a>(&self, token: RWLockWriteMode<'a>)
|
||||||
-> RWLockReadMode<'a> {
|
-> RWLockReadMode<'a> {
|
||||||
if !borrow::ref_eq(self, token.lock) {
|
if !reference::ref_eq(self, token.lock) {
|
||||||
fail!("Can't downgrade() with a different rwlock's write_mode!");
|
fail!("Can't downgrade() with a different rwlock's write_mode!");
|
||||||
}
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -123,7 +123,7 @@ pub mod send_str;
|
||||||
pub mod ptr;
|
pub mod ptr;
|
||||||
pub mod owned;
|
pub mod owned;
|
||||||
pub mod managed;
|
pub mod managed;
|
||||||
pub mod borrow;
|
pub mod reference;
|
||||||
pub mod rc;
|
pub mod rc;
|
||||||
pub mod gc;
|
pub mod gc;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
//! to implement this.
|
//! to implement this.
|
||||||
|
|
||||||
use any::AnyOwnExt;
|
use any::AnyOwnExt;
|
||||||
use borrow;
|
use reference;
|
||||||
use cast;
|
use cast;
|
||||||
use cleanup;
|
use cleanup;
|
||||||
use clone::Clone;
|
use clone::Clone;
|
||||||
|
@ -287,7 +287,7 @@ impl Task {
|
||||||
|
|
||||||
impl Drop for Task {
|
impl Drop for Task {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
rtdebug!("called drop for a task: {}", borrow::to_uint(self));
|
rtdebug!("called drop for a task: {}", reference::to_uint(self));
|
||||||
rtassert!(self.destroyed);
|
rtassert!(self.destroyed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
//
|
//
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#[feature(managed_boxes)];
|
#[feature(managed_boxes)];
|
||||||
|
|
||||||
use std::borrow;
|
use std::reference;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
fn borrow(x: &int, f: |x: &int|) {
|
fn borrow(x: &int, f: |x: &int|) {
|
||||||
|
@ -20,7 +20,7 @@ fn borrow(x: &int, f: |x: &int|) {
|
||||||
fn test1(x: @~int) {
|
fn test1(x: @~int) {
|
||||||
borrow(&*(*x).clone(), |p| {
|
borrow(&*(*x).clone(), |p| {
|
||||||
let x_a = ptr::to_unsafe_ptr(&**x);
|
let x_a = ptr::to_unsafe_ptr(&**x);
|
||||||
assert!((x_a as uint) != borrow::to_uint(p));
|
assert!((x_a as uint) != reference::to_uint(p));
|
||||||
assert_eq!(unsafe{*x_a}, *p);
|
assert_eq!(unsafe{*x_a}, *p);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
//
|
//
|
||||||
|
@ -8,9 +8,9 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use std::borrow;
|
use std::reference;
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let x = 3;
|
let x = 3;
|
||||||
info!("&x={:x}", borrow::to_uint(&x));
|
info!("&x={:x}", reference::to_uint(&x));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue