std::rt: s/pausible/pausable/.

This commit is contained in:
Huon Wilson 2013-12-15 16:29:17 +11:00
parent 55534100ce
commit c126aa5692
5 changed files with 23 additions and 23 deletions

View File

@ -13,7 +13,7 @@
use uvll;
use super::{Loop, UvHandle};
use std::rt::rtio::{Callback, PausibleIdleCallback};
use std::rt::rtio::{Callback, PausableIdleCallback};
pub struct IdleWatcher {
handle: *uvll::uv_idle_t,
@ -63,7 +63,7 @@ pub fn onetime(loop_: &mut Loop, f: proc()) {
}
}
impl PausibleIdleCallback for IdleWatcher {
impl PausableIdleCallback for IdleWatcher {
fn pause(&mut self) {
if self.idle_flag == true {
assert_eq!(unsafe {uvll::uv_idle_stop(self.handle) }, 0);
@ -99,7 +99,7 @@ fn drop(&mut self) {
mod test {
use super::*;
use std::rt::tube::Tube;
use std::rt::rtio::{Callback, PausibleIdleCallback};
use std::rt::rtio::{Callback, PausableIdleCallback};
use super::super::local_loop;
struct MyCallback(Tube<int>, int);

View File

@ -153,8 +153,8 @@ fn callback(&mut self, f: proc()) {
IdleWatcher::onetime(self.uvio.uv_loop(), f);
}
fn pausible_idle_callback(&mut self, cb: ~Callback) -> ~PausibleIdleCallback {
IdleWatcher::new(self.uvio.uv_loop(), cb) as ~PausibleIdleCallback
fn pausable_idle_callback(&mut self, cb: ~Callback) -> ~PausableIdleCallback {
IdleWatcher::new(self.uvio.uv_loop(), cb) as ~PausableIdleCallback
}
fn remote_callback(&mut self, f: ~Callback) -> ~RemoteCallback {

View File

@ -15,7 +15,7 @@
use prelude::*;
use cast;
use rt::rtio::{EventLoop, IoFactory, RemoteCallback, PausibleIdleCallback,
use rt::rtio::{EventLoop, IoFactory, RemoteCallback, PausableIdleCallback,
Callback};
use unstable::sync::Exclusive;
use io::native;
@ -28,7 +28,7 @@ pub fn event_loop() -> ~EventLoop {
struct BasicLoop {
work: ~[proc()], // pending work
idle: Option<*mut BasicPausible>, // only one is allowed
idle: Option<*mut BasicPausable>, // only one is allowed
remotes: ~[(uint, ~Callback)],
next_remote: uint,
messages: Exclusive<~[Message]>,
@ -142,14 +142,14 @@ fn callback(&mut self, f: proc()) {
}
// XXX: Seems like a really weird requirement to have an event loop provide.
fn pausible_idle_callback(&mut self, cb: ~Callback) -> ~PausibleIdleCallback {
let callback = ~BasicPausible::new(self, cb);
fn pausable_idle_callback(&mut self, cb: ~Callback) -> ~PausableIdleCallback {
let callback = ~BasicPausable::new(self, cb);
rtassert!(self.idle.is_none());
unsafe {
let cb_ptr: &*mut BasicPausible = cast::transmute(&callback);
let cb_ptr: &*mut BasicPausable = cast::transmute(&callback);
self.idle = Some(*cb_ptr);
}
return callback as ~PausibleIdleCallback;
return callback as ~PausableIdleCallback;
}
fn remote_callback(&mut self, f: ~Callback) -> ~RemoteCallback {
@ -196,15 +196,15 @@ fn drop(&mut self) {
}
}
struct BasicPausible {
struct BasicPausable {
eloop: *mut BasicLoop,
work: ~Callback,
active: bool,
}
impl BasicPausible {
fn new(eloop: &mut BasicLoop, cb: ~Callback) -> BasicPausible {
BasicPausible {
impl BasicPausable {
fn new(eloop: &mut BasicLoop, cb: ~Callback) -> BasicPausable {
BasicPausable {
active: false,
work: cb,
eloop: eloop,
@ -212,7 +212,7 @@ fn new(eloop: &mut BasicLoop, cb: ~Callback) -> BasicPausible {
}
}
impl PausibleIdleCallback for BasicPausible {
impl PausableIdleCallback for BasicPausable {
fn pause(&mut self) {
self.active = false;
}
@ -221,7 +221,7 @@ fn resume(&mut self) {
}
}
impl Drop for BasicPausible {
impl Drop for BasicPausable {
fn drop(&mut self) {
unsafe {
(*self.eloop).idle = None;

View File

@ -35,7 +35,7 @@ pub trait Callback {
pub trait EventLoop {
fn run(&mut self);
fn callback(&mut self, proc());
fn pausible_idle_callback(&mut self, ~Callback) -> ~PausibleIdleCallback;
fn pausable_idle_callback(&mut self, ~Callback) -> ~PausableIdleCallback;
fn remote_callback(&mut self, ~Callback) -> ~RemoteCallback;
/// The asynchronous I/O services. Not all event loops may provide one.
@ -265,7 +265,7 @@ pub trait RtioTTY {
fn isatty(&self) -> bool;
}
pub trait PausibleIdleCallback {
pub trait PausableIdleCallback {
fn pause(&mut self);
fn resume(&mut self);
}

View File

@ -22,7 +22,7 @@
use rt::deque;
use rt::local_ptr;
use rt::local::Local;
use rt::rtio::{RemoteCallback, PausibleIdleCallback, Callback};
use rt::rtio::{RemoteCallback, PausableIdleCallback, Callback};
use borrow::{to_uint};
use rand::{XorShiftRng, Rng, Rand};
use iter::range;
@ -76,7 +76,7 @@ pub struct Scheduler {
/// A fast XorShift rng for scheduler use
rng: XorShiftRng,
/// A togglable idle callback
idle_callback: Option<~PausibleIdleCallback>,
idle_callback: Option<~PausableIdleCallback>,
/// A countdown that starts at a random value and is decremented
/// every time a yield check is performed. When it hits 0 a task
/// will yield.
@ -86,7 +86,7 @@ pub struct Scheduler {
steal_for_yield: bool,
// n.b. currently destructors of an object are run in top-to-bottom in order
// of field declaration. Due to its nature, the pausible idle callback
// of field declaration. Due to its nature, the pausable idle callback
// must have some sort of handle to the event loop, so it needs to get
// destroyed before the event loop itself. For this reason, we destroy
// the event loop last to ensure that any unsafe references to it are
@ -170,7 +170,7 @@ pub fn bootstrap(mut ~self, task: ~Task) {
// Build an Idle callback.
let cb = ~SchedRunner as ~Callback;
self.idle_callback = Some(self.event_loop.pausible_idle_callback(cb));
self.idle_callback = Some(self.event_loop.pausable_idle_callback(cb));
// Initialize the TLS key.
local_ptr::init();