I'm newbie to Qt and I'm looking for multi-threading in Qt.
As I learned in Qt Documents, I defined two class for two thread:

#include <QThread>
#include <QMutex>

class thread_a : public QThread
{
    Q_OBJECT
public:
    explicit thread_a(QObject *parent = 0);
    int counter;

protected:
    void run();
};

And in CPP file:

#include "thread_a.h"

thread_a::thread_a(QObject *parent) :
    QThread(parent)
{
    counter=0;
}

void thread_a::run()
{
    counter++;
}

Second thread class is same, but with counter-- in run() method.
Then I run this two threads from main.ccp.

Now my question:
How can I share counter in thread_a and thread_b using QMutex?

Edit
Report