Skip to content
Snippets Groups Projects
Commit 48080256 authored by Martin Kröning's avatar Martin Kröning :crab:
Browse files

Remove unused WakeupReason

parent e8bd768c
No related branches found
No related tags found
No related merge requests found
......@@ -297,16 +297,6 @@ impl PerCoreScheduler {
irqsave(|| self.current_task.borrow().prio)
}
#[inline]
pub fn get_current_task_wakeup_reason(&self) -> WakeupReason {
irqsave(|| self.current_task.borrow_mut().last_wakeup_reason)
}
#[inline]
pub fn set_current_task_wakeup_reason(&mut self, reason: WakeupReason) {
irqsave(|| self.current_task.borrow_mut().last_wakeup_reason = reason);
}
#[cfg(target_arch = "x86_64")]
#[inline]
pub fn get_current_kernel_stack(&self) -> VirtAddr {
......
......@@ -35,13 +35,6 @@ pub enum TaskStatus {
Idle,
}
/// Reason why wakeup() has been called on a task.
#[derive(Clone, Copy, PartialEq)]
pub enum WakeupReason {
Custom,
Timer,
}
/// Unique identifier for a task (i.e. `pid`).
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug, Clone, Copy)]
pub struct TaskId(u32);
......@@ -365,8 +358,6 @@ pub struct Task {
pub prev: Option<Rc<RefCell<Task>>>,
/// Task Thread-Local-Storage (TLS)
pub tls: Option<TaskTLS>,
/// Reason why wakeup() has been called the last time
pub last_wakeup_reason: WakeupReason,
/// lwIP error code for this task
#[cfg(feature = "newlib")]
pub lwip_errno: i32,
......@@ -399,7 +390,6 @@ impl Task {
next: None,
prev: None,
tls: None,
last_wakeup_reason: WakeupReason::Custom,
#[cfg(feature = "newlib")]
lwip_errno: 0,
}
......@@ -420,7 +410,6 @@ impl Task {
next: None,
prev: None,
tls: None,
last_wakeup_reason: WakeupReason::Custom,
#[cfg(feature = "newlib")]
lwip_errno: 0,
}
......@@ -445,7 +434,6 @@ impl Task {
next: None,
prev: None,
tls: None,
last_wakeup_reason: task.last_wakeup_reason,
#[cfg(feature = "newlib")]
lwip_errno: 0,
}
......@@ -480,7 +468,7 @@ impl BlockedTaskQueue {
}
}
fn wakeup_task(task: Rc<RefCell<Task>>, reason: WakeupReason) {
fn wakeup_task(task: Rc<RefCell<Task>>) {
{
let mut borrowed = task.borrow_mut();
debug!(
......@@ -502,7 +490,6 @@ impl BlockedTaskQueue {
borrowed.id
);
borrowed.status = TaskStatus::Ready;
borrowed.last_wakeup_reason = reason;
}
// Add the task to the ready queue.
......@@ -563,7 +550,7 @@ impl BlockedTaskQueue {
while let Some(node) = cursor.current() {
if node.task.borrow().id == task.get_id() {
// Remove it from the list of blocked tasks and wake it up.
Self::wakeup_task(node.task.clone(), WakeupReason::Custom);
Self::wakeup_task(node.task.clone());
cursor.remove_current();
// If this is the first task, adjust the One-Shot Timer to fire at the
......@@ -607,7 +594,7 @@ impl BlockedTaskQueue {
}
// Otherwise, this task has elapsed, so remove it from the list and wake it up.
Self::wakeup_task(node.task.clone(), WakeupReason::Timer);
Self::wakeup_task(node.task.clone());
cursor.remove_current();
}
}
......
use crate::arch::percore::*;
use crate::scheduler::task::{TaskHandlePriorityQueue, WakeupReason};
use crate::scheduler::task::TaskHandlePriorityQueue;
use crate::synch::spinlock::SpinlockIrqSave;
use crossbeam_utils::Backoff;
......@@ -68,9 +68,7 @@ impl Semaphore {
/// least 1.
pub fn acquire(&self, time: Option<u64>) -> bool {
let backoff = Backoff::new();
// Reset last_wakeup_reason.
let core_scheduler = core_scheduler();
core_scheduler.set_current_task_wakeup_reason(WakeupReason::Custom);
let wakeup_time = time.map(|ms| crate::arch::processor::get_timer_ticks() + ms * 1000);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment