summaryrefslogtreecommitdiff
path: root/tests/test-Tasks.cc
blob: 2eedb47eedb9cc3af69f40fae4d741d4edb89549 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <Main.h>
#include <Task.h>
#include <TaskMan.h>

BALAU_STARTUP;

using namespace Balau;

class CustomPrinter : public Printer {
};

static CustomPrinter * customPrinter = NULL;

class MainTask : public Task {
  public:
    virtual const char * getName() { return "MainTask"; }
  private:
    virtual void Do() {
        customPrinter->setLocal();
        Printer::enable(M_ALL);
        Printer::log(M_DEBUG, "In MainTask::Do()");
    }
};

int Application::startup() throw (Balau::GeneralException) {
    customPrinter = new CustomPrinter();
    Printer::log(M_STATUS, "Test::Tasks running.");
    Task * mainTask = new MainTask();
    TaskMan::getTaskMan()->mainLoop();
    Printer::log(M_STATUS, "Test::Tasks passed.");
    Printer::log(M_DEBUG, "You shouldn't see that message.");
    return 0;
}