rumgedümpel
This commit is contained in:
54
main.cc
54
main.cc
@@ -12,6 +12,7 @@
|
||||
#include "device/textstream.h"
|
||||
#include "device/ps2controller.h"
|
||||
#include "arch/ioapic.h"
|
||||
#include "thread/scheduler.h"
|
||||
#include "user/app1/appl.h"
|
||||
#include "sync/ticketlock.h"
|
||||
#include "interrupt/guard.h"
|
||||
@@ -71,32 +72,32 @@ unsigned int testx, testy;
|
||||
|
||||
Context test1;
|
||||
uint8_t test1_stack[256];
|
||||
Thread test1_thread = Thread(&test1_stack[sizeof(test1_stack)-1]);
|
||||
//Application application = Application(test1_stack);
|
||||
//Thread test1_thread = Thread(&test1_stack[sizeof(test1_stack)-1]);
|
||||
Application application = Application(test1_stack);
|
||||
|
||||
Context test2;
|
||||
uint8_t test2_stack[256];
|
||||
Thread test2_thread = Thread(&test2_stack[sizeof(test2_stack)-1]);
|
||||
//Context test2;
|
||||
//uint8_t test2_stack[256];
|
||||
//Thread test2_thread = Thread(&test2_stack[sizeof(test2_stack)-1]);
|
||||
|
||||
void test_func1(){
|
||||
while(1){
|
||||
{
|
||||
Guarded g = Guard::enter();
|
||||
g.vault().kout << "test 1\n" << flush;
|
||||
}
|
||||
context_switch(&test2, &test1);
|
||||
}
|
||||
}
|
||||
|
||||
void test_func2(){
|
||||
while(1){
|
||||
{
|
||||
Guarded g = Guard::enter();
|
||||
g.vault().kout << "test 2\n" << flush;
|
||||
}
|
||||
context_switch(&test1, &test2);
|
||||
}
|
||||
}
|
||||
//void test_func1(){
|
||||
// while(1){
|
||||
// {
|
||||
// Guarded g = Guard::enter();
|
||||
// g.vault().kout << "test 1\n" << flush;
|
||||
// }
|
||||
// context_switch(&test2, &test1);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//void test_func2(){
|
||||
// while(1){
|
||||
// {
|
||||
// Guarded g = Guard::enter();
|
||||
// g.vault().kout << "test 2\n" << flush;
|
||||
// }
|
||||
// context_switch(&test1, &test2);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
@@ -126,7 +127,10 @@ extern "C" int main() {
|
||||
|
||||
DBG << "Main CPU " << static_cast<int>(LAPIC::getID()) << endl << flush;
|
||||
|
||||
test1_thread.go();
|
||||
Scheduler sch;
|
||||
sch.ready(&application);
|
||||
sch.schedule();
|
||||
|
||||
|
||||
//Application{}.action();
|
||||
while (true){
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// vim: set noet ts=4 sw=4:
|
||||
|
||||
#include "dispatcher.h"
|
||||
#include "core.h"
|
||||
#include "../arch/core.h"
|
||||
|
||||
Dispatcher::Dispatcher() {
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#pragma once
|
||||
#include "../thread/thread.h"
|
||||
#include "../types.h"
|
||||
#include "core.h"
|
||||
#include "../arch/core.h"
|
||||
|
||||
/*! \brief The dispatcher dispatches threads and puts the scheduler's
|
||||
* decisions into action.
|
||||
|
||||
@@ -22,7 +22,8 @@ void Scheduler::ready(Thread* that) {
|
||||
}
|
||||
|
||||
void Scheduler::resume(bool ready) {
|
||||
if (!active()->kill_flag)
|
||||
if (ready)
|
||||
//if (!active()->kill_flag)
|
||||
readyList.enqueue(*active());
|
||||
Thread* thread = readyList.dequeue();
|
||||
assert(thread != nullptr);
|
||||
|
||||
Reference in New Issue
Block a user