TaskPool updates

This commit is contained in:
Jakob Gillich
2014-11-17 20:10:16 +01:00
parent 125e1f7d63
commit 0020ad1e97

View File

@@ -6,10 +6,10 @@ use std::io::net::ip::Ipv4Addr;
static PHRASE: &'static [u8] = b"Hello World!";
fn hyper_handle(mut incoming: hyper::server::Incoming) {
let mut pool = TaskPool::new(100, || { proc(_) { } });
let mut pool = TaskPool::new(100);
for conn in incoming {
pool.execute(proc(_) {
pool.execute(proc() {
let (_, res) = conn.open().unwrap();
let mut res = res.start().unwrap();
res.write(PHRASE).unwrap();
@@ -21,4 +21,3 @@ fn hyper_handle(mut incoming: hyper::server::Incoming) {
fn main() {
hyper::Server::http(Ipv4Addr(127, 0, 0, 1), 3000).listen(hyper_handle).unwrap();
}