mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-13 04:26:48 +00:00
rip out unused task pointers
This commit is contained in:
parent
d9b23cb022
commit
4880065429
@ -12,14 +12,14 @@ native "c-stack-cdecl" mod rustrt {
|
||||
type void;
|
||||
type rust_port;
|
||||
|
||||
fn chan_id_send<~T>(unused_task: *void, t: *sys::type_desc,
|
||||
fn chan_id_send<~T>(t: *sys::type_desc,
|
||||
target_task: task::task, target_port: port_id,
|
||||
-data: T);
|
||||
|
||||
fn new_port(unused_task: *void, unit_sz: uint) -> *rust_port;
|
||||
fn del_port(unused_task: *void, po: *rust_port);
|
||||
fn drop_port(unused_task: *void, po: *rust_port);
|
||||
fn get_port_id(unused_task: *void, po: *rust_port) -> port_id;
|
||||
fn new_port(unit_sz: uint) -> *rust_port;
|
||||
fn del_port(po: *rust_port);
|
||||
fn drop_port(po: *rust_port);
|
||||
fn get_port_id(po: *rust_port) -> port_id;
|
||||
}
|
||||
|
||||
native "rust-intrinsic" mod rusti {
|
||||
@ -33,20 +33,20 @@ type port_id = int;
|
||||
tag chan<~T> { chan_t(task::task, port_id); }
|
||||
|
||||
resource port_ptr(po: *rustrt::rust_port) {
|
||||
rustrt::drop_port(ptr::null(), po);
|
||||
rustrt::del_port(ptr::null(), po);
|
||||
rustrt::drop_port(po);
|
||||
rustrt::del_port(po);
|
||||
}
|
||||
|
||||
tag port<~T> { port_t(@port_ptr); }
|
||||
|
||||
fn send<~T>(ch: chan<T>, -data: T) {
|
||||
let chan_t(t, p) = ch;
|
||||
rustrt::chan_id_send(ptr::null(), sys::get_type_desc::<T>(), t, p, data);
|
||||
rustrt::chan_id_send(sys::get_type_desc::<T>(), t, p, data);
|
||||
task::yield();
|
||||
}
|
||||
|
||||
fn port<~T>() -> port<T> {
|
||||
let p = rustrt::new_port(ptr::null(), sys::size_of::<T>());
|
||||
let p = rustrt::new_port(sys::size_of::<T>());
|
||||
ret port_t(@port_ptr(p));
|
||||
}
|
||||
|
||||
@ -55,6 +55,6 @@ fn recv<~T>(p: port<T>) -> T {
|
||||
}
|
||||
|
||||
fn chan<~T>(p: port<T>) -> chan<T> {
|
||||
let id = rustrt::get_port_id(ptr::null(), ***p);
|
||||
let id = rustrt::get_port_id(***p);
|
||||
ret chan_t(task::get_task_id(), id);
|
||||
}
|
||||
|
@ -559,8 +559,8 @@ void drop_port(rust_port *port) {
|
||||
port->ref_count--;
|
||||
}
|
||||
|
||||
extern "C" CDECL void
|
||||
chan_send(rust_chan *chan, void *sptr) {
|
||||
extern "C" CDECL
|
||||
void chan_send(rust_chan *chan, void *sptr) {
|
||||
chan->send(sptr);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user