use static logger
This commit is contained in:
@ -148,7 +148,7 @@ void LFBgraphics::drawStraightLine(unsigned int x1, unsigned int y1, unsigned in
|
||||
this->drawPixel(i, y1, col);
|
||||
}
|
||||
} else {
|
||||
log << ERROR << "Line is not straight" << endl;
|
||||
// Not straight
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
#define __LFBgraphics_include__
|
||||
|
||||
#include "devices/fonts/Fonts.h"
|
||||
#include "user/lib/Logger.h"
|
||||
|
||||
// Hilfsfunktionen um Farbwerte fuer einen Pixel zu erzeugen
|
||||
#define RGB_24(r, g, b) (unsigned int)((r << 16) + (g << 8) + b)
|
||||
@ -28,8 +27,6 @@ class LFBgraphics {
|
||||
private:
|
||||
LFBgraphics(const LFBgraphics& copy) = delete; // Verhindere Kopieren
|
||||
|
||||
Logger log;
|
||||
|
||||
// Hilfsfunktion fuer drawString
|
||||
void drawMonoBitmap(unsigned int x, unsigned int y,
|
||||
unsigned int width, unsigned int height,
|
||||
@ -42,7 +39,7 @@ public:
|
||||
unsigned int hfb; // Adresse des versteckten Buffers (optional, fuer Animationen)
|
||||
unsigned int mode; // Zeichnen im sichtbaren = 1 oder unsichtbaren = 0 Puffer
|
||||
|
||||
LFBgraphics() : log("LFBgraphics"), mode(BUFFER_VISIBLE) {};
|
||||
LFBgraphics() : mode(BUFFER_VISIBLE) {};
|
||||
|
||||
void clear();
|
||||
void drawPixel(unsigned int x, unsigned int y, unsigned int col);
|
||||
|
@ -21,15 +21,13 @@ private:
|
||||
enum { time_base = 838 }; /* ns */
|
||||
int timer_interval;
|
||||
|
||||
Logger log;
|
||||
|
||||
char indicator[4] = {'|', '/', '-', '\\'};
|
||||
unsigned int indicator_pos = 0;
|
||||
unsigned long last_indicator_refresh = 0;
|
||||
|
||||
public:
|
||||
// Zeitgeber initialisieren.
|
||||
PIT(int us) : log("PIT") {
|
||||
PIT(int us) {
|
||||
this->interval(us);
|
||||
}
|
||||
|
||||
|
@ -82,12 +82,12 @@ bool VESA::initGraphicMode(unsigned short mode) {
|
||||
|
||||
// Signaturen pruefen
|
||||
if (BC_params->AX != 0x004F) {
|
||||
log << ERROR << "VESA wird nicht unterstuetzt." << endl;
|
||||
log.error() << "VESA wird nicht unterstuetzt." << endl;
|
||||
return false;
|
||||
}
|
||||
if (ib->VbeSignature[0] != 'V' || ib->VbeSignature[1] != 'E' ||
|
||||
ib->VbeSignature[2] != 'S' || ib->VbeSignature[3] != 'A') {
|
||||
log << ERROR << "VESA wird nicht unterstuetzt." << endl;
|
||||
log.error() << "VESA wird nicht unterstuetzt." << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ bool VESA::initGraphicMode(unsigned short mode) {
|
||||
|
||||
// Text-Modi 0-3 haben keinen LFB
|
||||
if (mode > 3 && (minf->attributes & 0x90) == 0) {
|
||||
log << ERROR << "Grafikmodus bietet keinen linearen Framebuffer." << endl;
|
||||
log.error() << "Grafikmodus bietet keinen linearen Framebuffer." << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -128,6 +128,6 @@ bool VESA::initGraphicMode(unsigned short mode) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
log << ERROR << "Grafikmodus nicht gefunden." << endl;
|
||||
log.error() << "Grafikmodus nicht gefunden." << endl;
|
||||
return false;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
class VESA : public LFBgraphics {
|
||||
private:
|
||||
int mode_nr; // Nummer des Modus
|
||||
Logger log;
|
||||
NamedLogger log;
|
||||
|
||||
VESA(const VESA& copy) = delete; // Verhindere Kopieren
|
||||
|
||||
|
@ -161,10 +161,9 @@ void pg_init() {
|
||||
// sodass genau der physikalische Adressraum abgedeckt ist?
|
||||
num_pages = total_mem / (4096 * 1024);
|
||||
|
||||
Logger log("Paging"); // This is only called one time
|
||||
log << INFO << "pg_init: " << total_mem << endl;
|
||||
log << INFO << " total_mem: " << total_mem << endl;
|
||||
log << INFO << " #pages: " << total_mem / (4096 * 1024) << endl;
|
||||
Logger::instance() << INFO << "pg_init: " << total_mem << endl;
|
||||
Logger::instance() << INFO << " total_mem: " << total_mem << endl;
|
||||
Logger::instance() << INFO << " #pages: " << total_mem / (4096 * 1024) << endl;
|
||||
|
||||
//
|
||||
// Aufbau des Page-Directory
|
||||
|
@ -25,7 +25,7 @@ void BumpAllocator::init() {
|
||||
this->allocations = 0;
|
||||
this->next = (unsigned char*)heap_start;
|
||||
|
||||
log << INFO << "Initialized Bump Allocator" << endl;
|
||||
log.info() << "Initialized Bump Allocator" << endl;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@ -51,10 +51,10 @@ void* BumpAllocator::alloc(unsigned int req_size) {
|
||||
|
||||
/* Hier muess Code eingefuegt werden */
|
||||
|
||||
log << DEBUG << "Requested " << hex << req_size << " Bytes" << endl;
|
||||
log.debug() << "Requested " << hex << req_size << " Bytes" << endl;
|
||||
|
||||
if (req_size + (unsigned int)this->next > this->heap_end) {
|
||||
log << ERROR << " - More memory requested than available :(" << endl;
|
||||
log.error() << " - More memory requested than available :(" << endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ void* BumpAllocator::alloc(unsigned int req_size) {
|
||||
this->next = (unsigned char*)((unsigned int)this->next + req_size);
|
||||
this->allocations = this->allocations + 1;
|
||||
|
||||
log << TRACE << " - Allocated " << hex << req_size << " Bytes." << endl;
|
||||
log.trace() << " - Allocated " << hex << req_size << " Bytes." << endl;
|
||||
|
||||
return allocated;
|
||||
}
|
||||
@ -73,5 +73,5 @@ void* BumpAllocator::alloc(unsigned int req_size) {
|
||||
* Beschreibung: Nicht implementiert. *
|
||||
*****************************************************************************/
|
||||
void BumpAllocator::free(void* ptr) {
|
||||
log << ERROR << " mm_free: ptr= " << hex << (unsigned int)ptr << ", not supported" << endl;
|
||||
log.error() << " mm_free: ptr= " << hex << (unsigned int)ptr << ", not supported" << endl;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ private:
|
||||
unsigned char* next;
|
||||
unsigned int allocations;
|
||||
|
||||
Logger log;
|
||||
NamedLogger log;
|
||||
|
||||
BumpAllocator(Allocator& copy) = delete; // Verhindere Kopieren
|
||||
|
||||
|
@ -38,7 +38,7 @@ void LinkedListAllocator::init() {
|
||||
this->free_start->size = this->heap_size - sizeof(free_block_t);
|
||||
this->free_start->next = this->free_start; // Only one block, points to itself
|
||||
|
||||
log << INFO << "Initialized LinkedList Allocator" << endl;
|
||||
log.info() << "Initialized LinkedList Allocator" << endl;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@ -77,10 +77,10 @@ void* LinkedListAllocator::alloc(unsigned int req_size) {
|
||||
/* Hier muess Code eingefuegt werden */
|
||||
// NOTE: next pointer zeigt auf headeranfang, returned wird zeiger auf anfang des nutzbaren freispeichers
|
||||
|
||||
log << DEBUG << "Requested " << hex << req_size << " Bytes" << endl;
|
||||
log.debug() << "Requested " << hex << req_size << " Bytes" << endl;
|
||||
|
||||
if (this->free_start == NULL) {
|
||||
log << ERROR << " - No free memory remaining :(" << endl;
|
||||
log.error() << " - No free memory remaining :(" << endl;
|
||||
this->lock.release();
|
||||
return NULL;
|
||||
}
|
||||
@ -89,7 +89,7 @@ void* LinkedListAllocator::alloc(unsigned int req_size) {
|
||||
unsigned int req_size_diff = (BASIC_ALIGN - req_size % BASIC_ALIGN) % BASIC_ALIGN;
|
||||
unsigned int rreq_size = req_size + req_size_diff;
|
||||
if (req_size_diff > 0) {
|
||||
log << TRACE << " - Rounded to word border (+" << dec << req_size_diff << " bytes)" << endl;
|
||||
log.trace() << " - Rounded to word border (+" << dec << req_size_diff << " bytes)" << endl;
|
||||
}
|
||||
|
||||
free_block_t* current = this->free_start;
|
||||
@ -121,7 +121,7 @@ void* LinkedListAllocator::alloc(unsigned int req_size) {
|
||||
// Next-fit
|
||||
this->free_start = new_next;
|
||||
|
||||
log << TRACE << " - Allocated " << hex << rreq_size << " Bytes with cutting" << endl;
|
||||
log.trace() << " - Allocated " << hex << rreq_size << " Bytes with cutting" << endl;
|
||||
} else {
|
||||
// Block too small to be cut, allocate whole block
|
||||
|
||||
@ -129,11 +129,11 @@ void* LinkedListAllocator::alloc(unsigned int req_size) {
|
||||
this->free_start = current->next; // Pointer keeps pointing to current if last block
|
||||
if (this->free_start == current) {
|
||||
// No free block remaining
|
||||
log << TRACE << " - Disabled freelist" << endl;
|
||||
log.trace() << " - Disabled freelist" << endl;
|
||||
this->free_start = NULL;
|
||||
}
|
||||
|
||||
log << TRACE << " - Allocated " << hex << current->size << " Bytes without cutting" << endl;
|
||||
log.trace() << " - Allocated " << hex << current->size << " Bytes without cutting" << endl;
|
||||
}
|
||||
|
||||
// Block aushängen
|
||||
@ -149,14 +149,14 @@ void* LinkedListAllocator::alloc(unsigned int req_size) {
|
||||
|
||||
// HACK: Checking list integrity
|
||||
// free_block_t* c = current;
|
||||
// log << DEBUG << "Checking list Integrity" << endl;
|
||||
// log.debug() << "Checking list Integrity" << endl;
|
||||
// while (c->allocated) {
|
||||
// log << DEBUG << hex << (unsigned int)c << endl;
|
||||
// log.debug() << hex << (unsigned int)c << endl;
|
||||
// c = c->next;
|
||||
// }
|
||||
// log << DEBUG << "Finished check" << endl;
|
||||
// log.debug() << "Finished check" << endl;
|
||||
|
||||
log << DEBUG << "Returning memory address " << hex << ((unsigned int)current + sizeof(free_block_t)) << endl;
|
||||
log.debug() << "Returning memory address " << hex << ((unsigned int)current + sizeof(free_block_t)) << endl;
|
||||
this->lock.release();
|
||||
return (void*)((unsigned int)current + sizeof(free_block_t)); // Speicheranfang, nicht header
|
||||
}
|
||||
@ -164,7 +164,7 @@ void* LinkedListAllocator::alloc(unsigned int req_size) {
|
||||
current = current->next;
|
||||
} while (current != this->free_start); // Stop when arriving at the first block again
|
||||
|
||||
log << ERROR << " - More memory requested than available :(" << endl;
|
||||
log.error() << " - More memory requested than available :(" << endl;
|
||||
this->lock.release();
|
||||
return NULL;
|
||||
}
|
||||
@ -182,10 +182,10 @@ void LinkedListAllocator::free(void* ptr) {
|
||||
// Account for header
|
||||
free_block_t* block_start = (free_block_t*)((unsigned int)ptr - sizeof(free_block_t));
|
||||
|
||||
log << DEBUG << "Freeing " << hex << (unsigned int)ptr << ", Size: " << block_start->size << endl;
|
||||
log.debug() << "Freeing " << hex << (unsigned int)ptr << ", Size: " << block_start->size << endl;
|
||||
|
||||
if (!block_start->allocated) {
|
||||
log << ERROR << "Block already free" << endl;
|
||||
log.error() << "Block already free" << endl;
|
||||
this->lock.release();
|
||||
return;
|
||||
}
|
||||
@ -197,7 +197,7 @@ void LinkedListAllocator::free(void* ptr) {
|
||||
block_start->allocated = false;
|
||||
block_start->next = block_start;
|
||||
|
||||
log << TRACE << " - Enabling freelist with one block" << endl;
|
||||
log.trace() << " - Enabling freelist with one block" << endl;
|
||||
this->lock.release();
|
||||
return;
|
||||
}
|
||||
@ -226,16 +226,16 @@ void LinkedListAllocator::free(void* ptr) {
|
||||
// - If previous_free_next and block_start are the same block we can merge backward
|
||||
// Should result in: [block_start]
|
||||
|
||||
// log << TRACE << "Before doing any merging:" << endl;
|
||||
// log << TRACE << "previous_free:" << hex << (unsigned int)previous_free << "Size:" << previous_free->size << "Next:" << (unsigned int)previous_free->next << endl;
|
||||
// log << TRACE << "previous_free_next:" << hex << (unsigned int)previous_free_next << "Size:" << previous_free_next->size << "Next:" << (unsigned int)previous_free_next->next << endl;
|
||||
// log << TRACE << "block_start:" << hex << (unsigned int)block_start << "Size:" << block_start->size << "Next:" << (unsigned int)block_start->next << endl;
|
||||
// log << TRACE << "next_block:" << hex << (unsigned int)next_block << "Size:" << next_block->size << "Next:" << (unsigned int)next_block->next << endl;
|
||||
// log << TRACE << "next_free:" << hex << (unsigned int)next_free << "Size:" << next_free->size << "Next:" << (unsigned int)next_free->next << endl;
|
||||
// log.trace() << "Before doing any merging:" << endl;
|
||||
// log.trace() << "previous_free:" << hex << (unsigned int)previous_free << "Size:" << previous_free->size << "Next:" << (unsigned int)previous_free->next << endl;
|
||||
// log.trace() << "previous_free_next:" << hex << (unsigned int)previous_free_next << "Size:" << previous_free_next->size << "Next:" << (unsigned int)previous_free_next->next << endl;
|
||||
// log.trace() << "block_start:" << hex << (unsigned int)block_start << "Size:" << block_start->size << "Next:" << (unsigned int)block_start->next << endl;
|
||||
// log.trace() << "next_block:" << hex << (unsigned int)next_block << "Size:" << next_block->size << "Next:" << (unsigned int)next_block->next << endl;
|
||||
// log.trace() << "next_free:" << hex << (unsigned int)next_free << "Size:" << next_free->size << "Next:" << (unsigned int)next_free->next << endl;
|
||||
|
||||
// Try to merge forward ========================================================================
|
||||
if (next_block == next_free) {
|
||||
log << TRACE << " - Merging block forward" << endl;
|
||||
log.trace() << " - Merging block forward" << endl;
|
||||
|
||||
// Current and next adjacent block can be merged
|
||||
// [previous_free | previous_free_next | <> | block_start | next_free]
|
||||
@ -257,7 +257,7 @@ void LinkedListAllocator::free(void* ptr) {
|
||||
|
||||
if (this->free_start == next_free) {
|
||||
// next_free is now invalid after merge
|
||||
log << TRACE << " - Moving freelist start to " << hex << (unsigned int)block_start << endl;
|
||||
log.trace() << " - Moving freelist start to " << hex << (unsigned int)block_start << endl;
|
||||
this->free_start = block_start;
|
||||
}
|
||||
} else {
|
||||
@ -273,7 +273,7 @@ void LinkedListAllocator::free(void* ptr) {
|
||||
|
||||
// Try to merge backward =====================================================================
|
||||
if (previous_free_next == block_start) {
|
||||
log << TRACE << " - Merging block backward" << endl;
|
||||
log.trace() << " - Merging block backward" << endl;
|
||||
|
||||
// Current and previous adjacent block can be merged
|
||||
// [previous_free | block_start]
|
||||
@ -286,7 +286,7 @@ void LinkedListAllocator::free(void* ptr) {
|
||||
|
||||
if (this->free_start == block_start) {
|
||||
// block_start is now invalid after merge
|
||||
log << TRACE << " - Moving freelist start to " << hex << (unsigned int)previous_free << endl;
|
||||
log.trace() << " - Moving freelist start to " << hex << (unsigned int)previous_free << endl;
|
||||
this->free_start = previous_free;
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ private:
|
||||
// aren't reachable from the freelist.
|
||||
static struct free_block* find_previous_block(struct free_block*);
|
||||
|
||||
Logger log;
|
||||
NamedLogger log;
|
||||
SpinLock lock;
|
||||
|
||||
public:
|
||||
|
@ -14,7 +14,7 @@ void TreeAllocator::init() {
|
||||
this->free_start->next = (list_block_t*)this->free_start;
|
||||
this->free_start->previous = (list_block_t*)this->free_start;
|
||||
|
||||
log << INFO << "Initialized Tree Allocator" << endl;
|
||||
log.info() << "Initialized Tree Allocator" << endl;
|
||||
}
|
||||
|
||||
void TreeAllocator::dump_free_memory() {
|
||||
@ -29,7 +29,7 @@ void TreeAllocator::dump_free_memory() {
|
||||
}
|
||||
|
||||
void* TreeAllocator::alloc(unsigned int req_size) {
|
||||
log << DEBUG << "Requested " << dec << req_size << " Bytes" << endl;
|
||||
log.debug() << "Requested " << dec << req_size << " Bytes" << endl;
|
||||
|
||||
// Round to word borders + tree_block size
|
||||
unsigned int rreq_size = req_size;
|
||||
@ -37,28 +37,28 @@ void* TreeAllocator::alloc(unsigned int req_size) {
|
||||
// the list_block_t is part of every block, but when freeing
|
||||
// memory we need enough space to store the rbt metadata
|
||||
rreq_size = sizeof(tree_block_t) - sizeof(list_block_t);
|
||||
log << TRACE << " - Increased block size for rbt metadata" << endl;
|
||||
log.trace() << " - Increased block size for rbt metadata" << endl;
|
||||
}
|
||||
unsigned int req_size_diff = (BASIC_ALIGN - rreq_size % BASIC_ALIGN) % BASIC_ALIGN;
|
||||
rreq_size = rreq_size + req_size_diff;
|
||||
if (req_size_diff > 0) {
|
||||
log << TRACE << " - Rounded to word border (+" << dec << req_size_diff << " bytes)" << endl;
|
||||
log.trace() << " - Rounded to word border (+" << dec << req_size_diff << " bytes)" << endl;
|
||||
}
|
||||
|
||||
// Finds smallest block that is large enough
|
||||
tree_block_t* best_fit = this->rbt_search_bestfit(rreq_size);
|
||||
if (best_fit == NULL) {
|
||||
log << ERROR << " - No block found" << endl;
|
||||
log.error() << " - No block found" << endl;
|
||||
return NULL;
|
||||
}
|
||||
if (best_fit->allocated) {
|
||||
// Something went really wrong
|
||||
log << ERROR << " - Block already allocated :(" << endl;
|
||||
log.error() << " - Block already allocated :(" << endl;
|
||||
return NULL;
|
||||
}
|
||||
best_fit->allocated = true;
|
||||
unsigned int size = this->get_size(best_fit);
|
||||
log << TRACE << " - Found best-fit: " << hex << (unsigned int)best_fit << endl;
|
||||
log.trace() << " - Found best-fit: " << hex << (unsigned int)best_fit << endl;
|
||||
|
||||
// HACK: I didn't want to handle situations with only one block (where the tree root would
|
||||
// get removed), so I make sure there are always at least 2 blocks by inserting a dummy
|
||||
@ -72,7 +72,7 @@ void* TreeAllocator::alloc(unsigned int req_size) {
|
||||
this->rbt_remove(best_fit); // BUG: Can trigger bluescreen
|
||||
if (size > HEAP_MIN_FREE_BLOCK_SIZE + rreq_size + sizeof(list_block_t)) {
|
||||
// Block can be cut
|
||||
log << TRACE << " - Allocating " << dec << rreq_size << " Bytes with cutting" << endl;
|
||||
log.trace() << " - Allocating " << dec << rreq_size << " Bytes with cutting" << endl;
|
||||
|
||||
// [best_fit_start | sizeof(list_block_t) | rreq_size | new_block_start]
|
||||
tree_block_t* new_block = (tree_block_t*)((char*)best_fit + sizeof(list_block_t) + rreq_size);
|
||||
@ -83,18 +83,18 @@ void* TreeAllocator::alloc(unsigned int req_size) {
|
||||
// Don't cut block
|
||||
// The block is already correctly positioned in the linked list so we only
|
||||
// need to remove it from the freelist, which is done for both cases
|
||||
log << TRACE << " - Allocating " << dec << rreq_size << " Bytes without cutting" << endl;
|
||||
log.trace() << " - Allocating " << dec << rreq_size << " Bytes without cutting" << endl;
|
||||
}
|
||||
|
||||
// HACK: Remove the dummy element
|
||||
this->rbt_remove(&dummy);
|
||||
|
||||
log << TRACE << " - Returned address " << hex << (unsigned int)((char*)best_fit + sizeof(list_block_t)) << endl;
|
||||
log.trace() << " - Returned address " << hex << (unsigned int)((char*)best_fit + sizeof(list_block_t)) << endl;
|
||||
return (void*)((char*)best_fit + sizeof(list_block_t));
|
||||
}
|
||||
|
||||
void TreeAllocator::free(void* ptr) {
|
||||
log << INFO << "Freeing " << hex << (unsigned int)ptr << endl;
|
||||
log.info() << "Freeing " << hex << (unsigned int)ptr << endl;
|
||||
|
||||
list_block_t* block = (list_block_t*)((char*)ptr - sizeof(list_block_t));
|
||||
if (!block->allocated) {
|
||||
@ -119,7 +119,7 @@ void TreeAllocator::free(void* ptr) {
|
||||
|
||||
if (!next->allocated) {
|
||||
// Merge forward
|
||||
log << TRACE << " - Merging forward" << endl;
|
||||
log.trace() << " - Merging forward" << endl;
|
||||
|
||||
// Remove the next block from all lists as it is now part of our freed block
|
||||
this->dll_remove(next);
|
||||
@ -132,7 +132,7 @@ void TreeAllocator::free(void* ptr) {
|
||||
|
||||
if (!previous->allocated) {
|
||||
// Merge backward
|
||||
log << TRACE << " - Merging backward" << endl;
|
||||
log.trace() << " - Merging backward" << endl;
|
||||
|
||||
// Remove the current block from all lists as it is now part of the previous block
|
||||
// It doesn't have to be removed from rbt as it wasn't in there as it was allocated before
|
||||
|
@ -37,7 +37,7 @@ private:
|
||||
// Root of the rbt
|
||||
tree_block_t* free_start;
|
||||
|
||||
Logger log;
|
||||
NamedLogger log;
|
||||
|
||||
TreeAllocator(Allocator& copy) = delete; // Verhindere Kopieren
|
||||
|
||||
|
@ -61,12 +61,12 @@ int IntDispatcher::assign(unsigned int vector, ISR& isr) {
|
||||
/* hier muss Code eingefuegt werden */
|
||||
|
||||
if (vector >= this->size) {
|
||||
log << ERROR << "Invalid vector number when assigning" << endl;
|
||||
log.error() << "Invalid vector number when assigning" << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
this->map[vector] = &isr;
|
||||
log << INFO << "Registered ISR for vector " << dec << vector << endl;
|
||||
log.info() << "Registered ISR for vector " << dec << vector << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -92,15 +92,15 @@ int IntDispatcher::report(unsigned int vector) {
|
||||
ISR* isr = this->map[vector];
|
||||
|
||||
if (isr == 0) {
|
||||
log << ERROR << "No ISR registered for vector " << vector << endl;
|
||||
log.error() << "No ISR registered for vector " << vector << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// 32 = Timer
|
||||
// 33 = Keyboard
|
||||
// log << TRACE << "Interrupt: " << dec << vector << endl;
|
||||
// log.trace() << "Interrupt: " << dec << vector << endl;
|
||||
if (vector == 33) {
|
||||
log << DEBUG << "Keyboard Interrupt" << endl;
|
||||
log.debug() << "Keyboard Interrupt" << endl;
|
||||
}
|
||||
|
||||
isr->trigger();
|
||||
|
@ -17,11 +17,10 @@
|
||||
#include "user/lib/Logger.h"
|
||||
|
||||
class IntDispatcher {
|
||||
|
||||
private:
|
||||
IntDispatcher(const IntDispatcher& copy) = delete; // Verhindere Kopieren
|
||||
|
||||
Logger log;
|
||||
NamedLogger log;
|
||||
|
||||
enum { size = 256 };
|
||||
ISR* map[size];
|
||||
|
@ -23,10 +23,10 @@ public:
|
||||
|
||||
void run() override {
|
||||
// Idle-Thread läuft, ab jetzt ist der Scheduler fertig initialisiert
|
||||
log << INFO << "IdleThread enabled preemption" << endl;
|
||||
log.info() << "IdleThread enabled preemption" << endl;
|
||||
scheduler.enable_preemption(this->tid);
|
||||
if (!scheduler.preemption_enabled()) {
|
||||
log << ERROR << "Preemption disabled" << endl;
|
||||
log.error() << "Preemption disabled" << endl;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
|
@ -39,10 +39,10 @@ void Scheduler::start(bse::Vector<bse::unique_ptr<Thread>>::Iterator next) {
|
||||
active = next;
|
||||
if (active >= ready_queue.end()) {
|
||||
active = ready_queue.begin();
|
||||
log << DEBUG << "Scheduler::start started different thread than passed" << endl;
|
||||
log.debug() << "Scheduler::start started different thread than passed" << endl;
|
||||
}
|
||||
if constexpr (INSANE_TRACE) {
|
||||
log << TRACE << "Starting Thread with id: " << dec << (*active)->tid << endl;
|
||||
log.trace() << "Starting Thread with id: " << dec << (*active)->tid << endl;
|
||||
}
|
||||
(*active)->start(); // First dereference the Iterator, then the unique_ptr to get Thread
|
||||
}
|
||||
@ -51,10 +51,10 @@ void Scheduler::switch_to(Thread* prev_raw, bse::Vector<bse::unique_ptr<Thread>>
|
||||
active = next;
|
||||
if (active >= ready_queue.end()) {
|
||||
active = ready_queue.begin();
|
||||
// log << DEBUG << "Scheduler::switch_to started different thread than passed" << endl;
|
||||
// log.debug() << "Scheduler::switch_to started different thread than passed" << endl;
|
||||
}
|
||||
if constexpr (INSANE_TRACE) {
|
||||
log << TRACE << "Switching to Thread with id: " << dec << (*active)->tid << endl;
|
||||
log.trace() << "Switching to Thread with id: " << dec << (*active)->tid << endl;
|
||||
}
|
||||
prev_raw->switchTo(**active);
|
||||
}
|
||||
@ -74,7 +74,7 @@ void Scheduler::schedule() {
|
||||
// run() function is blocking
|
||||
|
||||
ready_queue.push_back(bse::make_unique<IdleThread>());
|
||||
log << INFO << "Starting scheduling: starting thread with id: " << dec << (*(ready_queue.end() - 1))->tid << endl;
|
||||
log.info() << "Starting scheduling: starting thread with id: " << dec << (*(ready_queue.end() - 1))->tid << endl;
|
||||
start(ready_queue.end() - 1);
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ void Scheduler::schedule() {
|
||||
*****************************************************************************/
|
||||
void Scheduler::ready(bse::unique_ptr<Thread>&& thread) {
|
||||
cpu.disable_int();
|
||||
log << DEBUG << "Adding to ready_queue, ID: " << dec << thread->tid << endl;
|
||||
log.debug() << "Adding to ready_queue, ID: " << dec << thread->tid << endl;
|
||||
ready_queue.push_back(std::move(thread));
|
||||
cpu.enable_int();
|
||||
}
|
||||
@ -106,12 +106,12 @@ void Scheduler::exit() {
|
||||
cpu.disable_int();
|
||||
|
||||
if (ready_queue.size() == 1) {
|
||||
log << ERROR << "Can't exit last thread, active ID: " << dec << (*active)->tid << endl;
|
||||
log.error() << "Can't exit last thread, active ID: " << dec << (*active)->tid << endl;
|
||||
cpu.enable_int();
|
||||
return;
|
||||
}
|
||||
|
||||
log << DEBUG << "Exiting thread, ID: " << dec << (*active)->tid << endl;
|
||||
log.debug() << "Exiting thread, ID: " << dec << (*active)->tid << endl;
|
||||
start(ready_queue.erase(active)); // erase returns the next iterator after the erased element
|
||||
// cannot use switch_to here as the previous thread no longer
|
||||
// exists (was deleted by erase)
|
||||
@ -149,7 +149,7 @@ void Scheduler::kill(unsigned int tid, bse::unique_ptr<Thread>* ptr) {
|
||||
|
||||
// Just erase from queue, do not need to switch
|
||||
block_queue.erase(it);
|
||||
log << INFO << "Killed thread from block_queue with id: " << tid << endl;
|
||||
log.info() << "Killed thread from block_queue with id: " << tid << endl;
|
||||
|
||||
cpu.enable_int();
|
||||
return;
|
||||
@ -158,7 +158,7 @@ void Scheduler::kill(unsigned int tid, bse::unique_ptr<Thread>* ptr) {
|
||||
|
||||
// Ready queue, can't kill last one
|
||||
if (ready_queue.size() == 1) {
|
||||
log << ERROR << "Kill: Can't kill last thread in ready_queue with id: " << tid << endl;
|
||||
log.error() << "Kill: Can't kill last thread in ready_queue with id: " << tid << endl;
|
||||
cpu.enable_int();
|
||||
return;
|
||||
}
|
||||
@ -175,7 +175,7 @@ void Scheduler::kill(unsigned int tid, bse::unique_ptr<Thread>* ptr) {
|
||||
|
||||
if (tid == prev_tid) {
|
||||
// If we killed the active thread we need to switch to another one
|
||||
log << INFO << "Killed active thread from ready_queue with id: " << tid << endl;
|
||||
log.info() << "Killed active thread from ready_queue with id: " << tid << endl;
|
||||
|
||||
// Switch to current active after old active was removed
|
||||
start(ready_queue.erase(it));
|
||||
@ -183,14 +183,14 @@ void Scheduler::kill(unsigned int tid, bse::unique_ptr<Thread>* ptr) {
|
||||
|
||||
// Just erase from queue, do not need to switch
|
||||
ready_queue.erase(it);
|
||||
log << INFO << "Killed thread from ready_queue with id: " << tid << endl;
|
||||
log.info() << "Killed thread from ready_queue with id: " << tid << endl;
|
||||
|
||||
cpu.enable_int();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
log << ERROR << "Kill: Couldn't find thread with id: " << tid << " in ready- or block-queue" << endl;
|
||||
log.error() << "Kill: Couldn't find thread with id: " << tid << " in ready- or block-queue" << endl;
|
||||
cpu.enable_int();
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ void Scheduler::nice_kill(unsigned int tid, bse::unique_ptr<Thread>* ptr) {
|
||||
for (bse::unique_ptr<Thread>& thread : block_queue) {
|
||||
if (thread->tid == tid) {
|
||||
thread->suicide();
|
||||
log << INFO << "Nice killed thread in block_queue with id: " << tid << endl;
|
||||
log.info() << "Nice killed thread in block_queue with id: " << tid << endl;
|
||||
deblock(tid);
|
||||
cpu.enable_int();
|
||||
return;
|
||||
@ -212,13 +212,13 @@ void Scheduler::nice_kill(unsigned int tid, bse::unique_ptr<Thread>* ptr) {
|
||||
for (bse::unique_ptr<Thread>& thread : ready_queue) {
|
||||
if (thread->tid == tid) {
|
||||
thread->suicide();
|
||||
log << INFO << "Nice killed thread in ready_queue with id: " << tid << endl;
|
||||
log.info() << "Nice killed thread in ready_queue with id: " << tid << endl;
|
||||
cpu.enable_int();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
log << ERROR << "Can't nice kill thread (not found) with id: " << tid << endl;
|
||||
log.error() << "Can't nice kill thread (not found) with id: " << tid << endl;
|
||||
cpu.enable_int();
|
||||
}
|
||||
|
||||
@ -242,13 +242,13 @@ void Scheduler::yield() {
|
||||
|
||||
if (ready_queue.size() == 1) {
|
||||
if constexpr (INSANE_TRACE) {
|
||||
log << TRACE << "Skipping yield as no thread is waiting, active ID: " << dec << (*active)->tid << endl;
|
||||
log.trace() << "Skipping yield as no thread is waiting, active ID: " << dec << (*active)->tid << endl;
|
||||
}
|
||||
cpu.enable_int();
|
||||
return;
|
||||
}
|
||||
if constexpr (INSANE_TRACE) {
|
||||
log << TRACE << "Yielding, ID: " << dec << (*active)->tid << endl;
|
||||
log.trace() << "Yielding, ID: " << dec << (*active)->tid << endl;
|
||||
}
|
||||
switch_to((*active).get(), active + 1); // prev_raw is valid since no thread was killed/deleted
|
||||
}
|
||||
@ -285,7 +285,7 @@ void Scheduler::block() {
|
||||
cpu.disable_int();
|
||||
|
||||
if (ready_queue.size() == 1) {
|
||||
log << ERROR << "Can't block last thread, active ID: " << dec << (*active)->tid << endl;
|
||||
log.error() << "Can't block last thread, active ID: " << dec << (*active)->tid << endl;
|
||||
cpu.enable_int();
|
||||
return;
|
||||
}
|
||||
@ -295,7 +295,7 @@ void Scheduler::block() {
|
||||
block_queue.push_back(std::move(ready_queue[pos]));
|
||||
|
||||
if constexpr (INSANE_TRACE) {
|
||||
log << TRACE << "Blocked thread with id: " << prev_raw->tid << endl;
|
||||
log.trace() << "Blocked thread with id: " << prev_raw->tid << endl;
|
||||
}
|
||||
|
||||
switch_to(prev_raw, ready_queue.erase(active)); // prev_raw is valid as thread was moved before vector erase
|
||||
@ -327,13 +327,13 @@ void Scheduler::deblock(unsigned int tid) {
|
||||
// thread to prefer deblocked threads
|
||||
block_queue.erase(it);
|
||||
if constexpr (INSANE_TRACE) {
|
||||
log << TRACE << "Deblocked thread with id: " << tid << endl;
|
||||
log.trace() << "Deblocked thread with id: " << tid << endl;
|
||||
}
|
||||
cpu.enable_int();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
log << ERROR << "Couldn't deblock thread with id: " << tid << endl;
|
||||
log.error() << "Couldn't deblock thread with id: " << tid << endl;
|
||||
cpu.enable_int();
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class Scheduler {
|
||||
private:
|
||||
Scheduler(const Scheduler& copy) = delete; // Verhindere Kopieren
|
||||
|
||||
Logger log;
|
||||
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
|
||||
|
@ -30,7 +30,6 @@ extern "C" {
|
||||
void Thread_switch(struct ThreadState* regs_now, struct ThreadState* reg_then);
|
||||
}
|
||||
|
||||
Logger Thread::log = Logger("Thread");
|
||||
unsigned int ThreadCnt = 1; // Skip tid 0 as the scheduler indicates no preemption with 0
|
||||
|
||||
/*****************************************************************************
|
||||
@ -107,8 +106,8 @@ void kickoff(Thread* object) {
|
||||
* Parameter: *
|
||||
* stack Stack für die neue Koroutine *
|
||||
*****************************************************************************/
|
||||
Thread::Thread(char* name) : name(name), stack(new unsigned int[1024]), tid(ThreadCnt++) {
|
||||
Thread::log << INFO << "Initialized thread with ID: " << this->tid << " (" << name << ")" << endl;
|
||||
Thread::Thread(char* name) : stack(new unsigned int[1024]), log(name), name(name), tid(ThreadCnt++) {
|
||||
log.info() << "Initialized thread with ID: " << this->tid << " (" << name << ")" << endl;
|
||||
Thread_init(®s, stack + 1024, kickoff, this); // Stack grows from top to bottom
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ private:
|
||||
protected:
|
||||
Thread(char* name);
|
||||
|
||||
static Logger log;
|
||||
NamedLogger log;
|
||||
|
||||
bool running = true; // For soft exit, if thread uses infinite loop inside run(), use this as condition
|
||||
char* name; // For logging
|
||||
@ -50,7 +50,7 @@ protected:
|
||||
|
||||
public:
|
||||
virtual ~Thread() {
|
||||
log << INFO << "Uninitialized thread, ID: " << dec << this->tid << " (" << name << ")" << endl;
|
||||
log.info() << "Uninitialized thread, ID: " << dec << this->tid << " (" << name << ")" << endl;
|
||||
delete[] this->stack;
|
||||
}
|
||||
|
||||
|
@ -10,114 +10,114 @@ void SmartPointerDemo::run() {
|
||||
kout << "Output is written to log to be able to trace memory allocations/deallocations" << endl;
|
||||
|
||||
{
|
||||
log << INFO << "Allocating new unique_ptr<int>..." << endl;
|
||||
log.info() << "Allocating new unique_ptr<int>..." << endl;
|
||||
bse::unique_ptr<int> ptr = bse::make_unique<int>(1);
|
||||
log << INFO << "Leaving scope..." << endl;
|
||||
log.info() << "Leaving scope..." << endl;
|
||||
}
|
||||
log << INFO << "Should be deleted by now..." << endl;
|
||||
log.info() << "Should be deleted by now..." << endl;
|
||||
|
||||
{
|
||||
log << INFO << "Allocating new unique_ptr<int>..." << endl;
|
||||
log.info() << "Allocating new unique_ptr<int>..." << endl;
|
||||
bse::unique_ptr<int> ptr1 = bse::make_unique<int>(1);
|
||||
bse::unique_ptr<int> ptr2;
|
||||
|
||||
log << INFO << "*ptr1 == " << *ptr1 << ", (bool)ptr2 == " << (bool)ptr2 << endl;
|
||||
log << INFO << "Moving ptr1 => ptr2 (no allocations should happen)..." << endl;
|
||||
log.info() << "*ptr1 == " << *ptr1 << ", (bool)ptr2 == " << (bool)ptr2 << endl;
|
||||
log.info() << "Moving ptr1 => ptr2 (no allocations should happen)..." << endl;
|
||||
ptr2 = std::move(ptr1);
|
||||
log << INFO << "(bool)ptr1 == " << (bool)ptr1 << ", *ptr2 == " << *ptr2 << endl;
|
||||
log.info() << "(bool)ptr1 == " << (bool)ptr1 << ", *ptr2 == " << *ptr2 << endl;
|
||||
|
||||
log << INFO << "Leaving scope..." << endl;
|
||||
log.info() << "Leaving scope..." << endl;
|
||||
}
|
||||
log << INFO << "Should be deleted by now..." << endl;
|
||||
log.info() << "Should be deleted by now..." << endl;
|
||||
|
||||
{
|
||||
log << INFO << "Allocating (2) new unique_ptr<int>..." << endl;
|
||||
log.info() << "Allocating (2) new unique_ptr<int>..." << endl;
|
||||
bse::unique_ptr<int> ptr1 = bse::make_unique<int>(1);
|
||||
bse::unique_ptr<int> ptr2 = bse::make_unique<int>(1);
|
||||
|
||||
log << INFO << "Moving ptr1 => ptr2 (ptr1 should be freed)..." << endl;
|
||||
log.info() << "Moving ptr1 => ptr2 (ptr1 should be freed)..." << endl;
|
||||
ptr2 = std::move(ptr1);
|
||||
|
||||
log << INFO << "Leaving scope..." << endl;
|
||||
log.info() << "Leaving scope..." << endl;
|
||||
}
|
||||
log << INFO << "Should be deleted by now..." << endl;
|
||||
log.info() << "Should be deleted by now..." << endl;
|
||||
|
||||
// =====================================================================
|
||||
|
||||
{
|
||||
log << INFO << "Allocating new unique_ptr<int[]>..." << endl;
|
||||
log.info() << "Allocating new unique_ptr<int[]>..." << endl;
|
||||
bse::unique_ptr<int[]> ptr = bse::make_unique<int[]>(10);
|
||||
ptr[0] = 1;
|
||||
log << INFO << "ptr[0] == " << ptr[0] << endl;
|
||||
log.info() << "ptr[0] == " << ptr[0] << endl;
|
||||
}
|
||||
log << INFO << "Should be deleted by now..." << endl;
|
||||
log.info() << "Should be deleted by now..." << endl;
|
||||
|
||||
{
|
||||
log << INFO << "Allocating new unique_ptr<int[10]>..." << endl;
|
||||
log.info() << "Allocating new unique_ptr<int[10]>..." << endl;
|
||||
bse::unique_ptr<int[]> ptr1 = bse::make_unique<int[]>(10);
|
||||
bse::unique_ptr<int[]> ptr2;
|
||||
|
||||
log << INFO << "Moving ptr1 => ptr2 (no allocations should happen)..." << endl;
|
||||
log.info() << "Moving ptr1 => ptr2 (no allocations should happen)..." << endl;
|
||||
ptr2 = std::move(ptr1);
|
||||
|
||||
log << INFO << "Leaving scope..." << endl;
|
||||
log.info() << "Leaving scope..." << endl;
|
||||
}
|
||||
log << INFO << "Should be deleted by now..." << endl;
|
||||
log.info() << "Should be deleted by now..." << endl;
|
||||
|
||||
{
|
||||
log << INFO << "Allocating (2) new unique_ptr<int[10]>..." << endl;
|
||||
log.info() << "Allocating (2) new unique_ptr<int[10]>..." << endl;
|
||||
bse::unique_ptr<int> ptr1 = bse::make_unique<int>(10);
|
||||
bse::unique_ptr<int> ptr2 = bse::make_unique<int>(10);
|
||||
|
||||
log << INFO << "Moving ptr1 => ptr2 (ptr1 should be freed)..." << endl;
|
||||
log.info() << "Moving ptr1 => ptr2 (ptr1 should be freed)..." << endl;
|
||||
ptr2 = std::move(ptr1);
|
||||
|
||||
log << INFO << "Leaving scope..." << endl;
|
||||
log.info() << "Leaving scope..." << endl;
|
||||
}
|
||||
log << INFO << "Should be deleted by now..." << endl;
|
||||
log.info() << "Should be deleted by now..." << endl;
|
||||
|
||||
// NOTE: This wasn't working because of a missing operator[] delete in the allocator
|
||||
log << INFO << "Allocating unique_ptr<int>*..." << endl;
|
||||
log.info() << "Allocating unique_ptr<int>*..." << endl;
|
||||
bse::unique_ptr<int>* ptrptr = new bse::unique_ptr<int>[10];
|
||||
delete[] ptrptr;
|
||||
log << INFO << "Should be deleted by now..." << endl;
|
||||
log.info() << "Should be deleted by now..." << endl;
|
||||
|
||||
// =====================================================================
|
||||
|
||||
{
|
||||
log << INFO << "Stackallocating Array<bse::unique_ptr<int>, 10>..." << endl;
|
||||
log.info() << "Stackallocating Array<bse::unique_ptr<int>, 10>..." << endl;
|
||||
bse::Array<bse::unique_ptr<int>, 10> arr;
|
||||
log << INFO << "Populating slot 0..." << endl;
|
||||
log.info() << "Populating slot 0..." << endl;
|
||||
arr[0] = bse::make_unique<int>(1);
|
||||
log << INFO << "Moving slot 0 to slot 1..." << endl;
|
||||
log.info() << "Moving slot 0 to slot 1..." << endl;
|
||||
arr[1] = std::move(arr[0]);
|
||||
log << INFO << "Leaving scope" << endl;
|
||||
log.info() << "Leaving scope" << endl;
|
||||
}
|
||||
log << INFO << "Should be deleted by now..." << endl;
|
||||
log.info() << "Should be deleted by now..." << endl;
|
||||
|
||||
{
|
||||
log << INFO << "Heapallocating Array<bse::unique_ptr<int>, 10>..." << endl;
|
||||
log.info() << "Heapallocating Array<bse::unique_ptr<int>, 10>..." << endl;
|
||||
bse::Array<bse::unique_ptr<int>, 10>* arr = new bse::Array<bse::unique_ptr<int>, 10>;
|
||||
log << INFO << "Populating slot 0..." << endl;
|
||||
log.info() << "Populating slot 0..." << endl;
|
||||
(*arr)[0] = bse::make_unique<int>(1);
|
||||
log << INFO << "Moving slot 0 to slot 1..." << endl;
|
||||
log.info() << "Moving slot 0 to slot 1..." << endl;
|
||||
(*arr)[1] = std::move((*arr)[0]);
|
||||
log << INFO << "Deleting" << endl;
|
||||
log.info() << "Deleting" << endl;
|
||||
delete arr;
|
||||
log << INFO << "Leaving scope" << endl;
|
||||
log.info() << "Leaving scope" << endl;
|
||||
}
|
||||
log << INFO << "Should be deleted by now..." << endl;
|
||||
log.info() << "Should be deleted by now..." << endl;
|
||||
|
||||
{
|
||||
log << INFO << "ArrayList<bse::unique_ptr<int>>..." << endl;
|
||||
log.info() << "ArrayList<bse::unique_ptr<int>>..." << endl;
|
||||
bse::Vector<bse::unique_ptr<int>> vec;
|
||||
log << INFO << "2x insertion" << endl;
|
||||
log.info() << "2x insertion" << endl;
|
||||
vec.push_back(bse::make_unique<int>(1));
|
||||
vec.push_back(bse::make_unique<int>(2));
|
||||
|
||||
log << INFO << "Leaving scope" << endl;
|
||||
log.info() << "Leaving scope" << endl;
|
||||
}
|
||||
log << INFO << "Should be deleted by now..." << endl;
|
||||
log.info() << "Should be deleted by now..." << endl;
|
||||
|
||||
kout.unlock();
|
||||
scheduler.exit();
|
||||
|
@ -1,14 +1,12 @@
|
||||
#include "user/event/KeyEventListener.h"
|
||||
#include "kernel/Globals.h"
|
||||
|
||||
Logger KeyEventListener::log("KEvLis");
|
||||
|
||||
void KeyEventListener::trigger(char c) {
|
||||
this->lastChar = c;
|
||||
}
|
||||
|
||||
char KeyEventListener::waitForKeyEvent() const {
|
||||
log << DEBUG << "Thread with id: " << tid << " waiting for key event" << endl;
|
||||
Logger::instance() << DEBUG << "KEvLis:: Thread with id: " << tid << " waiting for key event" << endl;
|
||||
scheduler.block();
|
||||
return this->lastChar; // This is only executed after thread is woken up by manager
|
||||
}
|
||||
|
@ -7,8 +7,6 @@ class KeyEventListener {
|
||||
private:
|
||||
KeyEventListener(const KeyEventListener& copy) = delete;
|
||||
|
||||
static Logger log;
|
||||
|
||||
char lastChar = '\0';
|
||||
|
||||
public:
|
||||
|
@ -2,12 +2,12 @@
|
||||
#include "kernel/Globals.h"
|
||||
|
||||
void KeyEventManager::subscribe(KeyEventListener& sub) {
|
||||
log << DEBUG << "Subscribe, Thread ID: " << dec << sub.tid << endl;
|
||||
log.debug() << "Subscribe, Thread ID: " << dec << sub.tid << endl;
|
||||
this->listeners.push_back(&sub);
|
||||
}
|
||||
|
||||
void KeyEventManager::unsubscribe(KeyEventListener& unsub) {
|
||||
log << DEBUG << "Unsubscribe, Thread ID: " << dec << unsub.tid << endl;
|
||||
log.debug() << "Unsubscribe, Thread ID: " << dec << unsub.tid << endl;
|
||||
for (bse::Vector<KeyEventListener*>::Iterator it = listeners.begin(); it != listeners.end(); ++it) {
|
||||
if ((*it)->tid == unsub.tid) {
|
||||
this->listeners.erase(it);
|
||||
@ -17,9 +17,9 @@ void KeyEventManager::unsubscribe(KeyEventListener& unsub) {
|
||||
}
|
||||
|
||||
void KeyEventManager::broadcast(char c) {
|
||||
log << TRACE << "Beginning Broadcast" << endl;
|
||||
log.trace() << "Beginning Broadcast" << endl;
|
||||
for (KeyEventListener* listener : this->listeners) {
|
||||
log << TRACE << "Broadcasting " << c << " to Thread ID: " << dec << listener->tid << endl;
|
||||
log.trace() << "Broadcasting " << c << " to Thread ID: " << dec << listener->tid << endl;
|
||||
listener->trigger(c);
|
||||
scheduler.deblock(listener->tid);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ class KeyEventManager {
|
||||
private:
|
||||
KeyEventManager(const KeyEventManager& copy) = delete;
|
||||
|
||||
Logger log;
|
||||
NamedLogger log;
|
||||
|
||||
bse::Vector<KeyEventListener*> listeners;
|
||||
|
||||
|
Reference in New Issue
Block a user