Skip to content

Commit 21db888

Browse files
committed
---
yaml --- r: 11884 b: refs/heads/master c: 1366d65 h: refs/heads/master v: v3
1 parent c57925d commit 21db888

File tree

8 files changed

+25
-38
lines changed

8 files changed

+25
-38
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: b278d675a231fdfe825c72e499d59e8a3d07ffaa
2+
refs/heads/master: 1366d656605049f2e58525c7cad5433da9977db2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/libcore/task.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ fn spawn_raw(opts: task_opts, +f: fn~()) unsafe {
487487
let fptr = ptr::addr_of(f);
488488
let closure: *rust_closure = unsafe::reinterpret_cast(fptr);
489489

490-
let task_id = alt opts.sched {
490+
let new_task = alt opts.sched {
491491
none {
492492
rustrt::new_task()
493493
}
@@ -498,13 +498,13 @@ fn spawn_raw(opts: task_opts, +f: fn~()) unsafe {
498498

499499
option::may(opts.notify_chan) {|c|
500500
// FIXME (1087): Would like to do notification in Rust
501-
rustrt::rust_task_config_notify(task_id, c);
501+
rustrt::rust_task_config_notify(new_task, c);
502502
}
503503

504-
rustrt::start_task(task_id, closure);
504+
rustrt::start_task(new_task, closure);
505505
unsafe::leak(f);
506506

507-
fn new_task_in_new_sched(opts: sched_opts) -> task_id {
507+
fn new_task_in_new_sched(opts: sched_opts) -> *rust_task {
508508
if opts.native_stack_size != none {
509509
fail "native_stack_size scheduler option unimplemented";
510510
}
@@ -543,13 +543,13 @@ native mod rustrt {
543543
fn get_task_id() -> task_id;
544544
fn rust_get_task() -> *rust_task;
545545

546-
fn new_task() -> task_id;
547-
fn rust_new_task_in_sched(id: sched_id) -> task_id;
546+
fn new_task() -> *rust_task;
547+
fn rust_new_task_in_sched(id: sched_id) -> *rust_task;
548548

549549
fn rust_task_config_notify(
550-
id: task_id, &&chan: comm::chan<notification>);
550+
task: *rust_task, &&chan: comm::chan<notification>);
551551

552-
fn start_task(id: task_id, closure: *rust_closure);
552+
fn start_task(task: *rust_task, closure: *rust_closure);
553553

554554
fn rust_task_is_unwinding(rt: *rust_task) -> bool;
555555
fn unsupervise();

trunk/src/rt/rust.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ rust_start(uintptr_t main_fn, int argc, char **argv, void* crate_map) {
8181
rust_kernel *kernel = new rust_kernel(srv);
8282
rust_sched_id sched_id = kernel->create_scheduler(env->num_sched_threads);
8383
rust_scheduler *sched = kernel->get_scheduler_by_id(sched_id);
84-
rust_task_id root_id = sched->create_task(NULL, "main", MAIN_STACK_SIZE);
85-
rust_task *root_task = kernel->get_task_by_id(root_id);
86-
I(kernel, root_task != NULL);
84+
rust_task *root_task = sched->create_task(NULL, "main", MAIN_STACK_SIZE);
8785
rust_task_thread *thread = root_task->thread;
8886
command_line_args *args
8987
= new (kernel, "main command line args")
@@ -96,7 +94,6 @@ rust_start(uintptr_t main_fn, int argc, char **argv, void* crate_map) {
9694
}
9795

9896
root_task->start((spawn_fn)main_fn, NULL, args->args);
99-
root_task->deref();
10097
root_task = NULL;
10198

10299
int ret = kernel->wait_for_schedulers();

trunk/src/rt/rust_builtin.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -424,18 +424,18 @@ get_task_id() {
424424
return task->id;
425425
}
426426

427-
static rust_task_id
427+
static rust_task*
428428
new_task_common(rust_scheduler *sched, rust_task *parent) {
429429
return sched->create_task(parent, NULL);
430430
}
431431

432-
extern "C" CDECL rust_task_id
432+
extern "C" CDECL rust_task*
433433
new_task() {
434434
rust_task *task = rust_task_thread::get_task();
435435
return new_task_common(task->sched, task);
436436
}
437437

438-
extern "C" CDECL rust_task_id
438+
extern "C" CDECL rust_task*
439439
rust_new_task_in_sched(rust_sched_id id) {
440440
rust_task *task = rust_task_thread::get_task();
441441
rust_scheduler *sched = task->kernel->get_scheduler_by_id(id);
@@ -444,13 +444,8 @@ rust_new_task_in_sched(rust_sched_id id) {
444444
}
445445

446446
extern "C" CDECL void
447-
rust_task_config_notify(rust_task_id task_id, chan_handle *chan) {
448-
rust_task *task = rust_task_thread::get_task();
449-
rust_task *target = task->kernel->get_task_by_id(task_id);
450-
A(task->thread, target != NULL,
451-
"This function should only be called when we know the task exists");
447+
rust_task_config_notify(rust_task *target, chan_handle *chan) {
452448
target->config_notify(*chan);
453-
target->deref();
454449
}
455450

456451
extern "C" rust_task *
@@ -459,11 +454,8 @@ rust_get_task() {
459454
}
460455

461456
extern "C" CDECL void
462-
start_task(rust_task_id id, fn_env_pair *f) {
463-
rust_task *task = rust_task_thread::get_task();
464-
rust_task *target = task->kernel->get_task_by_id(id);
457+
start_task(rust_task *target, fn_env_pair *f) {
465458
target->start(f->f, f->env, NULL);
466-
target->deref();
467459
}
468460

469461
extern "C" CDECL int

trunk/src/rt/rust_scheduler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ rust_scheduler::kill_all_tasks() {
8282
}
8383
}
8484

85-
rust_task_id
85+
rust_task *
8686
rust_scheduler::create_task(rust_task *spawner, const char *name,
8787
size_t init_stack_sz) {
8888
size_t thread_no;
@@ -95,7 +95,7 @@ rust_scheduler::create_task(rust_task *spawner, const char *name,
9595
return thread->create_task(spawner, name, init_stack_sz);
9696
}
9797

98-
rust_task_id
98+
rust_task *
9999
rust_scheduler::create_task(rust_task *spawner, const char *name) {
100100
return create_task(spawner, name, env->min_stack_size);
101101
}

trunk/src/rt/rust_scheduler.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ class rust_scheduler : public kernel_owned<rust_scheduler> {
3939
void start_task_threads();
4040
void join_task_threads();
4141
void kill_all_tasks();
42-
rust_task_id create_task(rust_task *spawner,
43-
const char *name,
44-
size_t init_stack_sz);
45-
rust_task_id create_task(rust_task *spawner, const char *name);
42+
rust_task* create_task(rust_task *spawner,
43+
const char *name,
44+
size_t init_stack_sz);
45+
rust_task* create_task(rust_task *spawner, const char *name);
4646

4747
void release_task();
4848

trunk/src/rt/rust_task_thread.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,6 @@ void
159159
rust_task_thread::release_task(rust_task *task) {
160160
// Nobody should have a ref to the task at this point
161161
I(this, task->get_ref_count() == 0);
162-
// Kernel should not know about the task any more
163-
I(this, kernel->get_task_by_id(task->id) == NULL);
164162
// Now delete the task, which will require using this thread's
165163
// memory region.
166164
delete task;
@@ -304,7 +302,7 @@ rust_task_thread::get_cache() {
304302
return &cache;
305303
}
306304

307-
rust_task_id
305+
rust_task *
308306
rust_task_thread::create_task(rust_task *spawner, const char *name,
309307
size_t init_stack_sz) {
310308
rust_task *task =
@@ -319,7 +317,7 @@ rust_task_thread::create_task(rust_task *spawner, const char *name,
319317
}
320318

321319
kernel->register_task(task);
322-
return task->id;
320+
return task;
323321
}
324322

325323
void

trunk/src/rt/rust_task_thread.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ struct rust_task_thread : public kernel_owned<rust_task_thread>,
120120

121121
void kill_all_tasks();
122122

123-
rust_task_id create_task(rust_task *spawner, const char *name,
124-
size_t init_stack_sz);
123+
rust_task *create_task(rust_task *spawner, const char *name,
124+
size_t init_stack_sz);
125125

126126
void transition(rust_task *task,
127127
rust_task_list *src, rust_task_list *dst,

0 commit comments

Comments
 (0)