Skip to content

Select on newrt pipes #8008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 31, 2013
6 changes: 3 additions & 3 deletions src/libextra/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl<T:Freeze+Send> Arc<T> {
*/
pub fn unwrap(self) -> T {
let Arc { x: x } = self;
unsafe { x.unwrap() }
x.unwrap()
}
}

Expand Down Expand Up @@ -250,7 +250,7 @@ impl<T:Send> MutexArc<T> {
*/
pub fn unwrap(self) -> T {
let MutexArc { x: x } = self;
let inner = unsafe { x.unwrap() };
let inner = x.unwrap();
let MutexArcInner { failed: failed, data: data, _ } = inner;
if failed {
fail!(~"Can't unwrap poisoned MutexArc - another task failed inside!");
Expand Down Expand Up @@ -469,7 +469,7 @@ impl<T:Freeze + Send> RWArc<T> {
*/
pub fn unwrap(self) -> T {
let RWArc { x: x, _ } = self;
let inner = unsafe { x.unwrap() };
let inner = x.unwrap();
let RWArcInner { failed: failed, data: data, _ } = inner;
if failed {
fail!(~"Can't unwrap poisoned RWArc - another task failed inside!")
Expand Down
48 changes: 20 additions & 28 deletions src/libextra/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,9 @@ impl<Q:Send> Sem<Q> {
impl Sem<()> {
pub fn access<U>(&self, blk: &fn() -> U) -> U {
let mut release = None;
unsafe {
do task::unkillable {
self.acquire();
release = Some(SemRelease(self));
}
do task::unkillable {
self.acquire();
release = Some(SemRelease(self));
}
blk()
}
Expand All @@ -153,11 +151,9 @@ impl Sem<~[WaitQueue]> {

pub fn access_waitqueue<U>(&self, blk: &fn() -> U) -> U {
let mut release = None;
unsafe {
do task::unkillable {
self.acquire();
release = Some(SemAndSignalRelease(self));
}
do task::unkillable {
self.acquire();
release = Some(SemAndSignalRelease(self));
}
blk()
}
Expand Down Expand Up @@ -294,17 +290,15 @@ impl<'self> Condvar<'self> {
#[unsafe_destructor]
impl<'self> Drop for CondvarReacquire<'self> {
fn drop(&self) {
unsafe {
// Needs to succeed, instead of itself dying.
do task::unkillable {
match self.order {
Just(lock) => do lock.access {
self.sem.acquire();
},
Nothing => {
self.sem.acquire();
},
}
// Needs to succeed, instead of itself dying.
do task::unkillable {
match self.order {
Just(lock) => do lock.access {
self.sem.acquire();
},
Nothing => {
self.sem.acquire();
},
}
}
}
Expand Down Expand Up @@ -644,14 +638,12 @@ impl RWLock {
// Implementation slightly different from the slicker 'write's above.
// The exit path is conditional on whether the caller downgrades.
let mut _release = None;
unsafe {
do task::unkillable {
(&self.order_lock).acquire();
(&self.access_lock).acquire();
(&self.order_lock).release();
}
_release = Some(RWLockReleaseDowngrade(self));
do task::unkillable {
(&self.order_lock).acquire();
(&self.access_lock).acquire();
(&self.order_lock).release();
}
_release = Some(RWLockReleaseDowngrade(self));
blk(RWLockWriteMode { lock: self })
}

Expand Down
Loading