reformat
This commit is contained in:
@ -19,8 +19,6 @@
|
||||
|
||||
class Scheduler {
|
||||
private:
|
||||
Scheduler(const Scheduler& copy) = delete; // Verhindere Kopieren
|
||||
|
||||
NamedLogger log;
|
||||
|
||||
bse::vector<bse::unique_ptr<Thread>> ready_queue;
|
||||
@ -35,8 +33,8 @@ private:
|
||||
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
|
||||
/*[[noreturn]]*/ void start(bse::vector<bse::unique_ptr<Thread>>::iterator next); // Start next without prev
|
||||
/*[[noreturn]]*/ 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; }
|
||||
@ -45,6 +43,8 @@ private:
|
||||
void ready(bse::unique_ptr<Thread>&& thread);
|
||||
|
||||
public:
|
||||
Scheduler(const Scheduler& copy) = delete; // Verhindere Kopieren
|
||||
|
||||
Scheduler() : log("SCHED"), ready_queue(true), block_queue(true) {} // lazy queues, wait for allocator
|
||||
|
||||
// The scheduler has to init the queues explicitly after the allocator is available
|
||||
@ -63,7 +63,7 @@ public:
|
||||
bool preemption_enabled() const { return idle_tid != 0U; }
|
||||
|
||||
// Scheduler starten
|
||||
void schedule();
|
||||
/*[[noreturn]]*/ void schedule();
|
||||
|
||||
// Helper that directly constructs the thread, then readys it
|
||||
template<typename T, typename... Args>
|
||||
@ -80,13 +80,13 @@ public:
|
||||
// NOTE: When a thread exits itself it will disappear...
|
||||
// Maybe put exited threads in an exited queue?
|
||||
// Then they would have to be acquired from there to exit...
|
||||
void exit();
|
||||
/* [[noreturn]] */ void exit(); // Returns on error because we don't have exceptions
|
||||
|
||||
// Thread mit 'Gewalt' terminieren
|
||||
void kill(unsigned int tid, bse::unique_ptr<Thread>* ptr);
|
||||
void kill(unsigned int tid) { kill(tid, nullptr); }
|
||||
|
||||
// Ask thread to exit
|
||||
// Asks thread to exit
|
||||
// NOTE: I had many problems with killing threads that were stuck in some semaphore
|
||||
// or were involved in any locking mechanisms, so with this a thread can make sure
|
||||
// to "set things right" before exiting itself (but could also be ignored)
|
||||
@ -94,13 +94,13 @@ public:
|
||||
void nice_kill(unsigned int tid) { nice_kill(tid, nullptr); }
|
||||
|
||||
// CPU freiwillig abgeben und Auswahl des naechsten Threads
|
||||
void yield();
|
||||
/* [[noreturn]] */ void yield(); // Returns when only the idle thread runs
|
||||
|
||||
// Thread umschalten; wird aus der ISR des PITs gerufen
|
||||
void preempt();
|
||||
/* [[noreturn]] */ void preempt(); // Returns when only the idle thread runs
|
||||
|
||||
// Blocks current thread (move to block_queue)
|
||||
void block();
|
||||
/* [[noreturn]] */ void block(); // Returns on error because we don't have exceptions
|
||||
|
||||
// Deblock by tid (move to ready_queue)
|
||||
void deblock(unsigned int tid);
|
||||
|
||||
Reference in New Issue
Block a user