Skip to content

Commit

Permalink
fixing imports for Thread::spawn
Browse files Browse the repository at this point in the history
  • Loading branch information
Linda Goldstein committed Jan 18, 2015
1 parent ce98514 commit d114b28
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/inproc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::sync::mpsc::channel;

use std::collections::HashMap;
use std::collections::hash_map::Entry;
use std::thread::Thread;


pub enum InprocCommand {
Expand Down Expand Up @@ -74,7 +75,7 @@ impl InprocManager {
pub fn new() -> InprocManager {
let (tx, rx) = channel();

spawn(move || {
Thread::spawn(move || {
InprocManagerTask {
chan: rx,
inproc_binders: HashMap::new(),
Expand Down
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub use result::{ZmqResult, ZmqError};
pub use socket::ZmqSocket;



mod ctx;
mod consts;
mod inproc;
Expand All @@ -67,6 +68,8 @@ mod v2_protocol;

#[cfg(test)]
mod test {
use std::thread::Thread;

#[test]
fn test_socket_type() {
assert_eq!(super::SocketType::REQ as int, 3);
Expand Down Expand Up @@ -127,7 +130,7 @@ mod test {
let c = super::Context::new();
let req = c.socket(super::SocketType::REQ);

spawn(move || {
Thread::spawn(move || {
let mut req = req;
assert!(req.connect("inproc://#1").is_ok());

Expand Down
7 changes: 3 additions & 4 deletions src/stream_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use std::sync::{RwLock, Arc};
use std::sync::mpsc::Sender;
use std::sync::mpsc::Receiver;


const V2_GREETING_SIZE: uint = 12;
const NO_PROGRESS_LIMIT: uint = 1000;
const SIGNATURE_SIZE: uint = 10;
Expand Down Expand Up @@ -71,7 +70,7 @@ impl StreamEngine {
let (bytes_tx, bytes_rx) = channel();
let (waiter_tx, waiter_rx) = channel();
let stream = self.stream.clone();
spawn(move || {
Thread::spawn(move || {
stream_bytes_writer(bytes_rx, stream, waiter_tx);
});

Expand All @@ -92,7 +91,7 @@ impl StreamEngine {
// prepare task for sending Msg objects
let (msg_tx, msg_rx) = channel(); // TODO: replace with SyncSender
let stream = self.stream.clone();
spawn(move || {
Thread::spawn(move || {
stream_msg_writer(msg_rx, stream, encoder);
});

Expand Down Expand Up @@ -193,7 +192,7 @@ impl StreamEngine {
pub fn spawn_new(stream: TcpStream, options: Arc<RwLock<Options>>,
chan: Sender<ZmqResult<SocketMessage>>,
death_notifier: Option<Sender<u8>>) {
spawn(move || {
Thread::spawn(move || {
let mut engine = StreamEngine {
chan_to_socket: chan,
stream: stream,
Expand Down
2 changes: 1 addition & 1 deletion src/tcp_connecter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl TcpConnecter {

pub fn spawn_new(addr: SocketAddr, chan: Sender<ZmqResult<SocketMessage>>,
options: Arc<RwLock<Options>>) {
spawn(move || {
Thread::spawn(move || {
let reconnect_ivl = options.read().reconnect_ivl;
let mut connecter = TcpConnecter {
chan_to_socket: chan,
Expand Down
3 changes: 2 additions & 1 deletion src/tcp_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::io::net::tcp::TcpAcceptor;
use std::sync::Arc;
use std::sync::RwLock;
use std::sync::mpsc::Sender;
use std::thread::Thread;


static ACCEPT_TIMEOUT: u64 = 1000;
Expand Down Expand Up @@ -40,7 +41,7 @@ impl TcpListener {

pub fn spawn_new(acceptor: TcpAcceptor, chan: Sender<ZmqResult<SocketMessage>>,
options: Arc<RwLock<Options>>) {
spawn(move || {
Thread::spawn(move || {
let mut listener = TcpListener {
acceptor: acceptor,
options: options,
Expand Down

0 comments on commit d114b28

Please sign in to comment.