Skip to content

Instantly share code, notes, and snippets.

@robarnold
robarnold / task-comm-chan-chan.rs
Created July 28, 2011 04:35
Minimal-ish test case
use std;
import std::task;
tag request {
quit;
close(int, chan[bool]);
}
type ctx = chan[request];
use std;
fn producer(chan[u8[]] c) {
c <| ~[1u8, 2u8, 3u8, 4u8, 5u8, 6u8, 7u8, 8u8, 9u8, 10u8, 11u8, 12u8, 13u8 ];
}
fn main() {
let port[u8[]] p = port();
let task prod = spawn producer(chan(p));
use std;
import std::ivec;
tag msg {
closed;
received(u8[]);
}
fn producer(chan[u8[]] c) {
c <| ~[1u8, 2u8, 3u8, 4u8];
@robarnold
robarnold / t.rs
Created June 20, 2011 00:19
Rust issue #506
native "rust" mod rustrt {
fn task_yield();
}
fn main() {
spawn rustrt::task_yield();
}
SyntaxError: Unexpected token ILLEGAL
at Object.parse (native)
at IncomingMessage.<anonymous> (/usr/home/dev/tree-bot/builds.js:89:23)
at IncomingMessage.emit (events.js:81:20)
at HTTPParser.onMessageComplete (http.js:133:23)
at Socket.ondata (http.js:1213:22)
at Socket._onReadable (net.js:681:27)
at IOWatcher.onReadable [as callback] (net.js:177:10)