Skip to content

Commit 8693fcc

Browse files
committed
rt: Remove yield timers
1 parent 7f2980b commit 8693fcc

File tree

5 files changed

+4
-12
lines changed

5 files changed

+4
-12
lines changed

src/rt/rust_builtin.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "rust_scheduler.h"
55
#include "rust_task.h"
66
#include "rust_util.h"
7+
#include "sync/timer.h"
78

89
#if !defined(__WIN32__)
910
#include <sys/time.h>

src/rt/rust_internal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ extern "C" {
4747
#include "util/synchronized_indexed_list.h"
4848
#include "util/hash_map.h"
4949
#include "sync/sync.h"
50-
#include "sync/timer.h"
5150
#include "sync/lock_and_signal.h"
5251
#include "sync/lock_free_queue.h"
5352

src/rt/rust_scheduler.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,9 @@ rust_scheduler::log_state() {
207207
if (!running_tasks.is_empty()) {
208208
log(NULL, log_debug, "running tasks:");
209209
for (size_t i = 0; i < running_tasks.length(); i++) {
210-
log(NULL, log_debug, "\t task: %s @0x%" PRIxPTR
211-
" remaining: %" PRId64 " us",
210+
log(NULL, log_debug, "\t task: %s @0x%" PRIxPTR,
212211
running_tasks[i]->name,
213-
running_tasks[i],
214-
running_tasks[i]->yield_timer.remaining_us());
212+
running_tasks[i]);
215213
}
216214
}
217215

src/rt/rust_task.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,6 @@ rust_task::start(spawn_fn spawnee_fn,
395395

396396
void rust_task::start()
397397
{
398-
yield_timer.reset_us(0);
399398
transition(&sched->newborn_tasks, &sched->running_tasks);
400399
sched->lock.signal();
401400
}
@@ -407,8 +406,6 @@ rust_task::yield(size_t time_in_us, bool *killed) {
407406
*killed = true;
408407
}
409408

410-
yield_timer.reset_us(time_in_us);
411-
412409
// Return to the scheduler.
413410
ctx.next->swap(ctx);
414411

@@ -630,7 +627,7 @@ rust_task::backtrace() {
630627

631628
bool rust_task::can_schedule(int id)
632629
{
633-
return yield_timer.has_timed_out() &&
630+
return
634631
running_on == -1 &&
635632
(pinned_on == -1 || pinned_on == id);
636633
}

src/rt/rust_task.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ rust_task : public kernel_owned<rust_task>, rust_cond
9090

9191
rust_port_id next_port_id;
9292

93-
// Keeps track of the last time this task yielded.
94-
timer yield_timer;
95-
9693
// Rendezvous pointer for receiving data when blocked on a port. If we're
9794
// trying to read data and no data is available on any incoming channel,
9895
// we block on the port, and yield control to the scheduler. Since, we

0 commit comments

Comments
 (0)