Unsolved transfer data between main and subthread
-
is there any example on transfer data between main and subthread?
i try to pass a point from main to subthread, didn't work. any good examples?
for example i want do this.
int test;
int *test_pt;void main{
test=5;
*test_pt=6;
}void mythread::run()
{
int tmp, *tmp2;
tmp=test;
tmp2=test_pt;while(!stop){
//mutex
test=tmp+1;
*test_pt=tmp2+1;
//mutex unlock
}}
-
Take a look at http://doc.qt.io/qt-5/examples-threadandconcurrent.html - there are a lot of examples with threads.