fixed scheduler in vault. insert borderline reference

main
Simon 4 months ago
parent 68f0381c01
commit 698d0c155b

@ -2,18 +2,19 @@
* \brief \ref Guard synchronizes access to epilogue level
*/
#pragma once
//#pragma once
#include "../object/bbuffer.h"
#include "../object/key.h"
#include "../types.h"
#include "epilogues.h"
#include "../device/textstream.h"
#include "../thread/scheduler.h"
//! \brief The epilogue vault contains the protected data for the epilogue level
struct Vault {
Vault();
TextStream kout = TextStream(0, 80, 0, 10, true);
Scheduler sch = Scheduler();
// no copy
Vault(const Vault&) = delete;
Vault& operator=(const Vault&) = delete;

@ -22,7 +22,7 @@
///TextStream kout = TextStream(0, 80, 0, 10, true);
Ticketlock koutlock;
Scheduler sch;
//Scheduler sch;
//TextStream dout[8] = {
// TextStream(0 ,20,12,25,false),
@ -108,6 +108,7 @@ extern "C" int main() {
{
Guarded g = Guard::enter();
Scheduler &sch =g.vault().sch;
sch.ready(&application1);
sch.ready(&application2);
sch.ready(&application3);
@ -140,7 +141,7 @@ extern "C" int main() {
{
Guarded g = Guard::enter();
sch.schedule();
g.vault().sch.schedule();
}
@ -163,7 +164,7 @@ extern "C" int main_ap() {
{
Guarded g = Guard::enter();
sch.schedule();
g.vault().sch.schedule();
}
//assert(Core::getID() != 1);

@ -3,7 +3,7 @@
#include "thread.h"
#include "../debug/output.h"
#include "../arch/context.h"
#include "interrupt/guard.h"
// Alias to simplify stuff
typedef void (*kickoff_t)(void*);
@ -17,12 +17,12 @@ Thread::Thread(void* tos) {
}
#include "../thread/scheduler.h"
extern Scheduler sch;
void Thread::resume(Thread* next) {
Context *from = &sch.active()->context;
Guarded g = Guard::enter();
Context *from = &g.vault().sch.active()->context;
Context *to = &next->context;
sch.dispatcher.lifePointer[Core::getID()] = next;
g.vault().sch.dispatcher.lifePointer[Core::getID()] = next;
DBG << "from: " << hex << from << endl;
DBG << "to : " << hex << to << endl << flush;
context_switch(to, from);

@ -16,7 +16,6 @@
#include "../arch/context.h"
#include "../object/queue.h"
#include "../types.h"
#include "../interrupt/guard.h"
/*! \brief The Thread is an object used by the scheduler.
* \ingroup thread
*/

@ -9,9 +9,7 @@
#include "../../interrupt/guard.h"
#include "../../debug/output.h"
#include "../../arch/context.h"
#include "../../thread/scheduler.h"
extern Scheduler sch;
static uint8_t appl_cnt = 0;
char text[] = "Ich mag\n\
@ -57,12 +55,6 @@ void Application::action() { // NOLINT
//Core::pause();
//activeWaitDelay(10000000);
//{
// Guarded g = Guard::enter();
// sch.resume(true);
//}
if(cnt >= sizeof(text)-1)
cnt=0;
//context_switch(test2,test1);

Loading…
Cancel
Save