summaryrefslogtreecommitdiff
path: root/tests/test-Threads.cc
blob: 1005906a0ce3dbe6bbedc26935703e5b50f791ee (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
#include <Main.h>
#include <Threads.h>

BALAU_STARTUP;

using namespace Balau;

class TestThread : public Thread {
  private:
    virtual void * proc();
};

void * TestThread::proc() {
    Printer::log(M_STATUS, "Into a thread");
    return NULL;
}

void MainTask::Do() {
    Printer::log(M_STATUS, "Test::Threads running.");

    TestThread * t = new TestThread();
    Printer::log(M_STATUS, "Starting thread");
    t->threadStart();
    Printer::log(M_STATUS, "Joining thread");
    t->join();
    Printer::log(M_STATUS, "Deleting thread");
    delete t;

    Printer::log(M_STATUS, "Test::Threads passed.");
}