1

rename Vector to vector

This commit is contained in:
2022-07-23 21:37:00 +02:00
parent c8db2c8878
commit c95361552a
8 changed files with 23 additions and 27 deletions

View File

@ -35,7 +35,7 @@ constexpr const bool INSANE_TRACE = false;
* Parameter: *
* next Thread der die CPU erhalten soll. *
*****************************************************************************/
void Scheduler::start(bse::Vector<bse::unique_ptr<Thread>>::Iterator next) {
void Scheduler::start(bse::vector<bse::unique_ptr<Thread>>::Iterator next) {
active = next;
if (active >= ready_queue.end()) {
active = ready_queue.begin();
@ -47,7 +47,7 @@ void Scheduler::start(bse::Vector<bse::unique_ptr<Thread>>::Iterator next) {
(*active)->start(); // First dereference the Iterator, then the unique_ptr to get Thread
}
void Scheduler::switch_to(Thread* prev_raw, bse::Vector<bse::unique_ptr<Thread>>::Iterator next) {
void Scheduler::switch_to(Thread* prev_raw, bse::vector<bse::unique_ptr<Thread>>::Iterator next) {
active = next;
if (active >= ready_queue.end()) {
active = ready_queue.begin();
@ -137,7 +137,7 @@ void Scheduler::kill(unsigned int tid, bse::unique_ptr<Thread>* ptr) {
unsigned int prev_tid = (*active)->tid;
// Block queue, can always kill
for (bse::Vector<bse::unique_ptr<Thread>>::Iterator it = block_queue.begin(); it != block_queue.end(); ++it) {
for (bse::vector<bse::unique_ptr<Thread>>::Iterator it = block_queue.begin(); it != block_queue.end(); ++it) {
if ((*it)->tid == tid) {
// Found thread to kill
@ -163,7 +163,7 @@ void Scheduler::kill(unsigned int tid, bse::unique_ptr<Thread>* ptr) {
return;
}
for (bse::Vector<bse::unique_ptr<Thread>>::Iterator it = ready_queue.begin(); it != ready_queue.end(); ++it) {
for (bse::vector<bse::unique_ptr<Thread>>::Iterator it = ready_queue.begin(); it != ready_queue.end(); ++it) {
if ((*it)->tid == tid) {
// Found thread to kill
@ -318,7 +318,7 @@ void Scheduler::deblock(unsigned int tid) {
cpu.disable_int();
for (bse::Vector<bse::unique_ptr<Thread>>::Iterator it = block_queue.begin(); it != block_queue.end(); ++it) {
for (bse::vector<bse::unique_ptr<Thread>>::Iterator it = block_queue.begin(); it != block_queue.end(); ++it) {
if ((*it)->tid == tid) {
// Found thread with correct tid

View File

@ -23,25 +23,20 @@ private:
NamedLogger log;
// NOTE: Using this instead of the Queue is a side effect, I added the ArrayList for different reasons
// but my Queue was shit so I replaced it
// I want to use the queue again to get rid of the Vector overhead (copy + dynamic memory) but
// this is problematic with the unique_ptr, I guess I would have to wrap the threads in the "Chain"
// elements instead of a thread being a "Chain"
bse::Vector<bse::unique_ptr<Thread>> ready_queue;
bse::Vector<bse::unique_ptr<Thread>> block_queue;
bse::vector<bse::unique_ptr<Thread>> ready_queue;
bse::vector<bse::unique_ptr<Thread>> block_queue;
// NOTE: It makes sense to keep track of the active thread through this as it makes handling the
// unique_ptr easier and reduces the copying in the vector when cycling through the threads
bse::Vector<bse::unique_ptr<Thread>>::Iterator active = nullptr;
bse::vector<bse::unique_ptr<Thread>>::Iterator active = nullptr;
// Scheduler wird evt. von einer Unterbrechung vom Zeitgeber gerufen,
// bevor er initialisiert wurde
unsigned int idle_tid = 0U;
// Roughly the old dispatcher functionality
void start(bse::Vector<bse::unique_ptr<Thread>>::Iterator next); // Start next without prev
void switch_to(Thread* prev_raw, bse::Vector<bse::unique_ptr<Thread>>::Iterator next); // Switch from prev to next
void start(bse::vector<bse::unique_ptr<Thread>>::Iterator next); // Start next without prev
void switch_to(Thread* prev_raw, bse::vector<bse::unique_ptr<Thread>>::Iterator next); // Switch from prev to next
// Kann nur vom Idle-Thread aufgerufen werden (erster Thread der vom Scheduler gestartet wird)
void enable_preemption(unsigned int tid) { idle_tid = tid; }