aboutsummaryrefslogtreecommitdiff
path: root/sandbox/multithreading-tests/wait-for-subscription-thread/main.cpp
blob: 44390e2d332a931493db95e7f96f4ec993fc2c3a (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
#include <contextproperty.h>

#include "thread.h"

#include <QCoreApplication>
#include <QThread>

int main(int argc, char** argv)
{
    QCoreApplication app(argc, argv);

    qDebug() << "MAIN THREAD:" << QCoreApplication::instance()->thread();

    // Start a thread which will create the ContextProperty.
    Thread thread;
    thread.start();

    sleep(2);
    ContextProperty *cp = new ContextProperty("test.int");
    cp->waitForSubscription();
    qDebug() << "waiting is done in the main";

    return app.exec();
}