Skip to content

Commit 68f82de

Browse files
committed
rt: Remove task_yield builtin
This is just a special case of task_sleep
1 parent 2f8b695 commit 68f82de

File tree

4 files changed

+3
-11
lines changed

4 files changed

+3
-11
lines changed

src/lib/task.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ export spawn_joinable;
5353
native "cdecl" mod rustrt {
5454
// these must run on the Rust stack so that they can swap stacks etc:
5555
fn task_sleep(time_in_us: uint);
56-
fn task_yield();
5756
}
5857

5958
native "c-stack-cdecl" mod rustrt2 = "rustrt" {
@@ -149,7 +148,7 @@ Yield control to the task scheduler
149148
150149
The scheduler may schedule another task to execute.
151150
*/
152-
fn yield() { ret rustrt::task_yield(); }
151+
fn yield() { sleep(1u) }
153152

154153
/*
155154
Function: join

src/rt/rust_builtin.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,6 @@ task_sleep(size_t time_in_us) {
171171
task->yield(time_in_us);
172172
}
173173

174-
extern "C" CDECL void
175-
task_yield() {
176-
rust_task *task = rust_scheduler::get_task();
177-
task->yield(1);
178-
}
179-
180174
/* Debug builtins for std::dbg. */
181175

182176
static void

src/rt/rustrt.def.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ start_task
6060
vec_reserve_shared
6161
vec_from_buf_shared
6262
task_sleep
63-
task_yield
6463
unsupervise
6564
upcall_alloc_c_stack
6665
upcall_call_c_stack

src/test/run-pass/bind-native.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Can we bind native things?
33
*/
44

55
native "c-stack-cdecl" mod rustrt {
6-
fn task_yield();
6+
fn task_sleep();
77
}
88

9-
fn main() { bind rustrt::task_yield(); }
9+
fn main() { bind rustrt::task_sleep(); }

0 commit comments

Comments
 (0)