Skip to content
Snippets Groups Projects
  • Avi Kivity's avatar
    cc570220
    drivers: add debug_console · cc570220
    Avi Kivity authored
    A console driver that wraps another with a spinlock.  We usually don't want
    spinlocks, but if we want to debug the scheduler, we have to use them here.
    cc570220
    History
    drivers: add debug_console
    Avi Kivity authored
    A console driver that wraps another with a spinlock.  We usually don't want
    spinlocks, but if we want to debug the scheduler, we have to use them here.
debug-console.hh 477 B
#ifndef DEBUG_CONSOLE_HH_
#define DEBUG_CONSOLE_HH_

#include "console.hh"
#include "mutex.hh"

// Wrap a Console with a spinlock, used for debugging
// (we can't use a mutex, since we might want to debug the scheduler)

class debug_console : public Console {
public:
    explicit debug_console(Console& impl);
    virtual void write(const char *str, size_t len);
    virtual void newline();
private:
    Console& _impl;
    spinlock _lock;
};


#endif /* DEBUG_CONSOLE_HH_ */