update for new list interface
This commit is contained in:
@ -54,7 +54,7 @@ void Scheduler::ready(Thread* that) {
|
||||
|
||||
// Thread-Wechsel durch PIT verhindern
|
||||
cpu.disable_int();
|
||||
this->ready_queue.insert(that);
|
||||
this->ready_queue.insert_last(that);
|
||||
|
||||
log << DEBUG << "Adding to ready_queue, ID: " << dec << that->tid << endl;
|
||||
cpu.enable_int();
|
||||
@ -175,7 +175,7 @@ void Scheduler::yield() {
|
||||
}
|
||||
|
||||
Thread& next = *(Thread*)this->ready_queue.remove_first();
|
||||
this->ready_queue.insert(this->get_active());
|
||||
this->ready_queue.insert_last(this->get_active());
|
||||
|
||||
// log << TRACE << "Yielding, ID: " << dec << this->get_active()->tid << " => " << next.tid << endl;
|
||||
|
||||
@ -220,8 +220,8 @@ void Scheduler::block() {
|
||||
return;
|
||||
}
|
||||
|
||||
this->block_queue.insert(this->get_active()); // Thread that will be blocked waits in block_queue, so the scheduler can also
|
||||
// kill blocked threads (for example keyboard demo needs this)
|
||||
this->block_queue.insert_last(this->get_active()); // Thread that will be blocked waits in block_queue, so the scheduler can also
|
||||
// kill blocked threads (for example keyboard demo needs this)
|
||||
Thread& next = *(Thread*)this->ready_queue.remove_first();
|
||||
log << TRACE << "Blocking thread, ID: " << dec << this->get_active()->tid << " => " << next.tid << endl;
|
||||
|
||||
|
@ -11,7 +11,7 @@ void Semaphore::p() {
|
||||
this->lock.release();
|
||||
} else {
|
||||
// Block and manage thread in semaphore queue until it's woken up by v() again
|
||||
this->waitQueue.insert(scheduler.get_active());
|
||||
this->waitQueue.insert_last(scheduler.get_active());
|
||||
this->lock.release();
|
||||
scheduler.block(); // Moves to next thread
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ void ArrayListDemo::run() {
|
||||
|
||||
kout << "Adding elements in order" << endl;
|
||||
for (unsigned int i = 0; i < 5; ++i) {
|
||||
this->list.insert(i);
|
||||
this->list.insert_last(i);
|
||||
}
|
||||
this->list.print(kout);
|
||||
|
||||
@ -22,7 +22,7 @@ void ArrayListDemo::run() {
|
||||
kout << "Adding elements in order with realloc" << endl;
|
||||
for (unsigned int i = 0; i < 10; ++i) {
|
||||
kout << "Add " << dec << i << endl;
|
||||
this->list.insert(i);
|
||||
this->list.insert_last(i);
|
||||
}
|
||||
this->list.print(kout);
|
||||
|
||||
@ -35,7 +35,7 @@ void ArrayListDemo::run() {
|
||||
// ============================================================
|
||||
|
||||
for (unsigned int i = 0; i < 5; ++i) {
|
||||
this->list.insert(i);
|
||||
this->list.insert_last(i);
|
||||
}
|
||||
this->list.print(kout);
|
||||
|
||||
@ -62,14 +62,14 @@ void ArrayListDemo::run() {
|
||||
|
||||
// These are the threads
|
||||
int active = 0; // Idle thread
|
||||
this->list.insert(1);
|
||||
this->list.insert(2);
|
||||
this->list.insert(3);
|
||||
this->list.insert_last(1);
|
||||
this->list.insert_last(2);
|
||||
this->list.insert_last(3);
|
||||
this->list.print(kout);
|
||||
|
||||
kout << "Starting..." << endl;
|
||||
for (unsigned int n = 0; n < 10000000; ++n) {
|
||||
this->list.insert(active);
|
||||
for (unsigned int n = 0; n < 1000; ++n) {
|
||||
this->list.insert_last(active);
|
||||
active = list.remove_first();
|
||||
|
||||
if (this->list.size() != 3) {
|
||||
|
@ -7,9 +7,9 @@ void LinkedListDemo::run() {
|
||||
|
||||
kout << "Adding elements in order" << endl;
|
||||
for (unsigned int i = 0; i < 5; ++i) {
|
||||
this->list.insert(i);
|
||||
this->list.insert_last(i);
|
||||
}
|
||||
this->list.print(kout);
|
||||
this->list.print(kout); // BUG: Crash
|
||||
|
||||
kout << "Removing all elements from the front" << endl;
|
||||
for (unsigned int i = 0; i < 5; ++i) {
|
||||
@ -19,23 +19,23 @@ void LinkedListDemo::run() {
|
||||
|
||||
// ============================================================
|
||||
|
||||
kout << "Adding elements in order with realloc" << endl;
|
||||
for (unsigned int i = 0; i < 10; ++i) {
|
||||
kout << "Add " << dec << i << endl;
|
||||
this->list.insert(i);
|
||||
}
|
||||
this->list.print(kout);
|
||||
// kout << "Adding elements in order with realloc" << endl;
|
||||
// for (unsigned int i = 0; i < 10; ++i) {
|
||||
// kout << "Add " << dec << i << endl;
|
||||
// this->list.insert_last(i);
|
||||
// }
|
||||
// this->list.print(kout);
|
||||
|
||||
kout << "Removing all elements from the back" << endl;
|
||||
for (unsigned int i = 0; i < 10; ++i) {
|
||||
this->list.remove_last();
|
||||
}
|
||||
this->list.print(kout);
|
||||
// kout << "Removing all elements from the back" << endl;
|
||||
// for (unsigned int i = 0; i < 10; ++i) {
|
||||
// this->list.remove_last();
|
||||
// }
|
||||
// this->list.print(kout);
|
||||
|
||||
// ============================================================
|
||||
|
||||
for (unsigned int i = 0; i < 5; ++i) {
|
||||
this->list.insert(i);
|
||||
this->list.insert_last(i);
|
||||
}
|
||||
this->list.print(kout);
|
||||
|
||||
@ -62,14 +62,14 @@ void LinkedListDemo::run() {
|
||||
|
||||
// These are the threads
|
||||
int active = 0; // Idle thread
|
||||
this->list.insert(1);
|
||||
this->list.insert(2);
|
||||
this->list.insert(3);
|
||||
this->list.insert_last(1);
|
||||
this->list.insert_last(2);
|
||||
this->list.insert_last(3);
|
||||
this->list.print(kout);
|
||||
|
||||
kout << "Starting..." << endl;
|
||||
for (unsigned int n = 0; n < 10000000; ++n) {
|
||||
this->list.insert(active);
|
||||
for (unsigned int n = 0; n < 1000; ++n) {
|
||||
this->list.insert_last(active);
|
||||
active = list.remove_first();
|
||||
|
||||
if (this->list.size() != 3) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
void KeyEventManager::subscribe(KeyEventListener& listener) {
|
||||
log << DEBUG << "Subscribe, Thread ID: " << dec << listener.thread.tid << endl;
|
||||
this->listeners.insert(&listener);
|
||||
this->listeners.insert_last(&listener);
|
||||
}
|
||||
|
||||
void KeyEventManager::unsubscribe(KeyEventListener& listener) {
|
||||
|
Reference in New Issue
Block a user