rt: Remove task pinning. Does nothing
This commit is contained in:
@@ -37,8 +37,6 @@ export yield;
|
|||||||
export task_notification;
|
export task_notification;
|
||||||
export join;
|
export join;
|
||||||
export unsupervise;
|
export unsupervise;
|
||||||
export pin;
|
|
||||||
export unpin;
|
|
||||||
export task_result;
|
export task_result;
|
||||||
export tr_success;
|
export tr_success;
|
||||||
export tr_failure;
|
export tr_failure;
|
||||||
@@ -64,9 +62,6 @@ type rust_closure = {
|
|||||||
#[link_name = "rustrt"]
|
#[link_name = "rustrt"]
|
||||||
#[abi = "cdecl"]
|
#[abi = "cdecl"]
|
||||||
native mod rustrt {
|
native mod rustrt {
|
||||||
// these can run on the C stack:
|
|
||||||
fn pin_task();
|
|
||||||
fn unpin_task();
|
|
||||||
fn get_task_id() -> task_id;
|
fn get_task_id() -> task_id;
|
||||||
fn rust_get_task() -> *rust_task;
|
fn rust_get_task() -> *rust_task;
|
||||||
|
|
||||||
@@ -310,20 +305,6 @@ An unsupervised task will not propagate its failure up the task tree
|
|||||||
*/
|
*/
|
||||||
fn unsupervise() { ret sys::unsupervise(); }
|
fn unsupervise() { ret sys::unsupervise(); }
|
||||||
|
|
||||||
/*
|
|
||||||
Function: pin
|
|
||||||
|
|
||||||
Pins the current task and future child tasks to a single scheduler thread
|
|
||||||
*/
|
|
||||||
fn pin() { rustrt::pin_task(); }
|
|
||||||
|
|
||||||
/*
|
|
||||||
Function: unpin
|
|
||||||
|
|
||||||
Unpin the current task and future child tasks
|
|
||||||
*/
|
|
||||||
fn unpin() { rustrt::unpin_task(); }
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Function: currently_unwinding()
|
Function: currently_unwinding()
|
||||||
|
|
||||||
|
|||||||
@@ -380,18 +380,6 @@ nano_time(uint64_t *ns) {
|
|||||||
*ns = t.time_ns();
|
*ns = t.time_ns();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" CDECL void
|
|
||||||
pin_task() {
|
|
||||||
rust_task *task = rust_scheduler::get_task();
|
|
||||||
task->pin();
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" CDECL void
|
|
||||||
unpin_task() {
|
|
||||||
rust_task *task = rust_scheduler::get_task();
|
|
||||||
task->unpin();
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" CDECL rust_task_id
|
extern "C" CDECL rust_task_id
|
||||||
get_task_id() {
|
get_task_id() {
|
||||||
rust_task *task = rust_scheduler::get_task();
|
rust_task *task = rust_scheduler::get_task();
|
||||||
|
|||||||
@@ -331,9 +331,6 @@ rust_scheduler::create_task(rust_task *spawner, const char *name,
|
|||||||
rust_task (this, &newborn_tasks, spawner, name, init_stack_sz);
|
rust_task (this, &newborn_tasks, spawner, name, init_stack_sz);
|
||||||
DLOG(this, task, "created task: " PTR ", spawner: %s, name: %s",
|
DLOG(this, task, "created task: " PTR ", spawner: %s, name: %s",
|
||||||
task, spawner ? spawner->name : "null", name);
|
task, spawner ? spawner->name : "null", name);
|
||||||
if(spawner) {
|
|
||||||
task->pin(spawner->pinned_on);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
scoped_lock with(lock);
|
scoped_lock with(lock);
|
||||||
|
|||||||
@@ -245,7 +245,6 @@ rust_task::rust_task(rust_scheduler *sched, rust_task_list *state,
|
|||||||
next_port_id(0),
|
next_port_id(0),
|
||||||
rendezvous_ptr(0),
|
rendezvous_ptr(0),
|
||||||
running_on(-1),
|
running_on(-1),
|
||||||
pinned_on(-1),
|
|
||||||
local_region(&sched->srv->local_region),
|
local_region(&sched->srv->local_region),
|
||||||
boxed(&local_region),
|
boxed(&local_region),
|
||||||
unwinding(false),
|
unwinding(false),
|
||||||
@@ -628,8 +627,7 @@ rust_task::backtrace() {
|
|||||||
bool rust_task::can_schedule(int id)
|
bool rust_task::can_schedule(int id)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
running_on == -1 &&
|
running_on == -1;
|
||||||
(pinned_on == -1 || pinned_on == id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
@@ -637,20 +635,6 @@ rust_task::calloc(size_t size, const char *tag) {
|
|||||||
return local_region.calloc(size, tag);
|
return local_region.calloc(size, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rust_task::pin() {
|
|
||||||
I(this->sched, running_on != -1);
|
|
||||||
pinned_on = running_on;
|
|
||||||
}
|
|
||||||
|
|
||||||
void rust_task::pin(int id) {
|
|
||||||
I(this->sched, running_on == -1);
|
|
||||||
pinned_on = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void rust_task::unpin() {
|
|
||||||
pinned_on = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
rust_port_id rust_task::register_port(rust_port *port) {
|
rust_port_id rust_task::register_port(rust_port *port) {
|
||||||
I(sched, !lock.lock_held_by_current_thread());
|
I(sched, !lock.lock_held_by_current_thread());
|
||||||
scoped_lock with(lock);
|
scoped_lock with(lock);
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ rust_task : public kernel_owned<rust_task>, rust_cond
|
|||||||
// This flag indicates that a worker is either currently running the task
|
// This flag indicates that a worker is either currently running the task
|
||||||
// or is about to run this task.
|
// or is about to run this task.
|
||||||
int running_on;
|
int running_on;
|
||||||
int pinned_on;
|
|
||||||
|
|
||||||
memory_region local_region;
|
memory_region local_region;
|
||||||
boxed_region boxed;
|
boxed_region boxed;
|
||||||
@@ -180,10 +179,6 @@ rust_task : public kernel_owned<rust_task>, rust_cond
|
|||||||
|
|
||||||
void *calloc(size_t size, const char *tag);
|
void *calloc(size_t size, const char *tag);
|
||||||
|
|
||||||
void pin();
|
|
||||||
void pin(int id);
|
|
||||||
void unpin();
|
|
||||||
|
|
||||||
rust_port_id register_port(rust_port *port);
|
rust_port_id register_port(rust_port *port);
|
||||||
void release_port(rust_port_id id);
|
void release_port(rust_port_id id);
|
||||||
rust_port *get_port_by_id(rust_port_id id);
|
rust_port *get_port_by_id(rust_port_id id);
|
||||||
|
|||||||
@@ -20,9 +20,7 @@ leak
|
|||||||
nano_time
|
nano_time
|
||||||
new_port
|
new_port
|
||||||
new_task
|
new_task
|
||||||
pin_task
|
|
||||||
port_recv
|
port_recv
|
||||||
unpin_task
|
|
||||||
rand_free
|
rand_free
|
||||||
rand_new
|
rand_new
|
||||||
rand_next
|
rand_next
|
||||||
|
|||||||
@@ -8,14 +8,14 @@
|
|||||||
use std;
|
use std;
|
||||||
|
|
||||||
native mod rustrt {
|
native mod rustrt {
|
||||||
fn pin_task();
|
fn do_gc();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn getbig_call_c_and_fail(i: int) {
|
fn getbig_call_c_and_fail(i: int) {
|
||||||
if i != 0 {
|
if i != 0 {
|
||||||
getbig_call_c_and_fail(i - 1);
|
getbig_call_c_and_fail(i - 1);
|
||||||
} else {
|
} else {
|
||||||
rustrt::pin_task();
|
rustrt::do_gc();
|
||||||
fail;
|
fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Can we bind native things?
|
|||||||
|
|
||||||
#[abi = "cdecl"]
|
#[abi = "cdecl"]
|
||||||
native mod rustrt {
|
native mod rustrt {
|
||||||
fn pin_task();
|
fn do_gc();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { bind rustrt::pin_task(); }
|
fn main() { bind rustrt::do_gc(); }
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ native mod rustrt {
|
|||||||
fn rust_getcwd() -> str;
|
fn rust_getcwd() -> str;
|
||||||
fn refcount(box: @int);
|
fn refcount(box: @int);
|
||||||
fn do_gc();
|
fn do_gc();
|
||||||
fn pin_task();
|
|
||||||
fn unpin_task();
|
|
||||||
fn get_task_id();
|
fn get_task_id();
|
||||||
fn sched_threads();
|
fn sched_threads();
|
||||||
fn rust_get_task();
|
fn rust_get_task();
|
||||||
@@ -25,8 +23,6 @@ fn calllink02() { rustrt::last_os_error(); }
|
|||||||
fn calllink03() { rustrt::rust_getcwd(); }
|
fn calllink03() { rustrt::rust_getcwd(); }
|
||||||
fn calllink04() { rustrt::refcount(@0); }
|
fn calllink04() { rustrt::refcount(@0); }
|
||||||
fn calllink05() { rustrt::do_gc(); }
|
fn calllink05() { rustrt::do_gc(); }
|
||||||
fn calllink06() { rustrt::pin_task(); }
|
|
||||||
fn calllink07() { rustrt::unpin_task(); }
|
|
||||||
fn calllink08() { rustrt::get_task_id(); }
|
fn calllink08() { rustrt::get_task_id(); }
|
||||||
fn calllink09() { rustrt::sched_threads(); }
|
fn calllink09() { rustrt::sched_threads(); }
|
||||||
fn calllink10() { rustrt::rust_get_task(); }
|
fn calllink10() { rustrt::rust_get_task(); }
|
||||||
@@ -60,8 +56,6 @@ fn main() {
|
|||||||
calllink03,
|
calllink03,
|
||||||
calllink04,
|
calllink04,
|
||||||
calllink05,
|
calllink05,
|
||||||
calllink06,
|
|
||||||
calllink07,
|
|
||||||
calllink08,
|
calllink08,
|
||||||
calllink09,
|
calllink09,
|
||||||
calllink10
|
calllink10
|
||||||
|
|||||||
@@ -4,16 +4,16 @@
|
|||||||
#[abi = "cdecl"]
|
#[abi = "cdecl"]
|
||||||
#[link_name = "rustrt"]
|
#[link_name = "rustrt"]
|
||||||
native mod rustrt1 {
|
native mod rustrt1 {
|
||||||
fn pin_task();
|
fn do_gc();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[abi = "cdecl"]
|
#[abi = "cdecl"]
|
||||||
#[link_name = "rustrt"]
|
#[link_name = "rustrt"]
|
||||||
native mod rustrt2 {
|
native mod rustrt2 {
|
||||||
fn pin_task();
|
fn do_gc();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
rustrt1::pin_task();
|
rustrt1::do_gc();
|
||||||
rustrt2::pin_task();
|
rustrt2::do_gc();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
Exercises task pinning and unpinning. Doesn't really ensure it
|
|
||||||
works, just makes sure it runs.
|
|
||||||
*/
|
|
||||||
|
|
||||||
use std;
|
|
||||||
|
|
||||||
import task;
|
|
||||||
|
|
||||||
fn main() { task::pin(); task::unpin(); }
|
|
||||||
Reference in New Issue
Block a user