add real formatted debug logging with timestamps

This commit is contained in:
Kevin Hester
2020-12-25 15:17:56 +08:00
parent c349ad62e7
commit 59577b9d79
5 changed files with 108 additions and 1 deletions

View File

@@ -14,6 +14,8 @@ bool OSThread::showRun = false;
/// Show debugging info for threads we decide not to run;
bool OSThread::showWaiting = false;
const OSThread *OSThread::currentThread;
ThreadController mainController, timerController;
InterruptableDelay mainDelay;
@@ -68,12 +70,15 @@ bool OSThread::shouldRun(unsigned long time)
void OSThread::run()
{
currentThread = this;
auto newDelay = runOnce();
runned();
if (newDelay >= 0)
setInterval(newDelay);
currentThread = NULL;
}
} // namespace concurrency

View File

@@ -42,6 +42,10 @@ class OSThread : public Thread
static bool showWaiting;
public:
/// For debug printing only (might be null)
static const OSThread *currentThread;
OSThread(const char *name, uint32_t period = 0, ThreadController *controller = &mainController);
virtual ~OSThread();