How to run two functions of the same class in different threads












0















Hi I have a class named search and this class has two member functions. The consumer and the producer. This is the way I have activated these functions as two threads in qt.



thread1 = new QThread();
thread2 = new QThread();
mySearch = new Search() ;

mySearch->moveToThread(thread1);

mySearch->moveToThread(thread2);


connect(mySearch, SIGNAL(workRequested()), thread1, SLOT(start()));
connect(mySearch, SIGNAL(workRequested()), thread2, SLOT(start()));

connect(thread1, SIGNAL(started()),mySearch, SLOT(producer()));
connect(thread2, SIGNAL(started()),mySearch, SLOT(consumer()));

connect(mySearch, SIGNAL(finishedscan()), thread1, SLOT(quit()), Qt::DirectConnection);
connect(mySearch, SIGNAL(finishedscan()), thread2, SLOT(quit()), Qt::DirectConnection);


But, it seems that only one is activated. How should I activate both. Please let me know with an example.



Thanks.










share|improve this question


















  • 3





    A QObject can only "live" in a single thread. Thats by definition. You could create a wrapper around "Search" and let each wrapper live in a seperate thread

    – Felix
    Nov 21 '18 at 14:32











  • Thanks. I have a common circular buffer between these two threads. Will the consumer thread follow the changes of the buffer made by the producer if I define separate wrappers for each thread? If I write the two functions in two different classes then were should I define the common circular buffer? In the producer class or the consumer class? @Felix

    – zahra
    Nov 26 '18 at 5:51


















0















Hi I have a class named search and this class has two member functions. The consumer and the producer. This is the way I have activated these functions as two threads in qt.



thread1 = new QThread();
thread2 = new QThread();
mySearch = new Search() ;

mySearch->moveToThread(thread1);

mySearch->moveToThread(thread2);


connect(mySearch, SIGNAL(workRequested()), thread1, SLOT(start()));
connect(mySearch, SIGNAL(workRequested()), thread2, SLOT(start()));

connect(thread1, SIGNAL(started()),mySearch, SLOT(producer()));
connect(thread2, SIGNAL(started()),mySearch, SLOT(consumer()));

connect(mySearch, SIGNAL(finishedscan()), thread1, SLOT(quit()), Qt::DirectConnection);
connect(mySearch, SIGNAL(finishedscan()), thread2, SLOT(quit()), Qt::DirectConnection);


But, it seems that only one is activated. How should I activate both. Please let me know with an example.



Thanks.










share|improve this question


















  • 3





    A QObject can only "live" in a single thread. Thats by definition. You could create a wrapper around "Search" and let each wrapper live in a seperate thread

    – Felix
    Nov 21 '18 at 14:32











  • Thanks. I have a common circular buffer between these two threads. Will the consumer thread follow the changes of the buffer made by the producer if I define separate wrappers for each thread? If I write the two functions in two different classes then were should I define the common circular buffer? In the producer class or the consumer class? @Felix

    – zahra
    Nov 26 '18 at 5:51
















0












0








0








Hi I have a class named search and this class has two member functions. The consumer and the producer. This is the way I have activated these functions as two threads in qt.



thread1 = new QThread();
thread2 = new QThread();
mySearch = new Search() ;

mySearch->moveToThread(thread1);

mySearch->moveToThread(thread2);


connect(mySearch, SIGNAL(workRequested()), thread1, SLOT(start()));
connect(mySearch, SIGNAL(workRequested()), thread2, SLOT(start()));

connect(thread1, SIGNAL(started()),mySearch, SLOT(producer()));
connect(thread2, SIGNAL(started()),mySearch, SLOT(consumer()));

connect(mySearch, SIGNAL(finishedscan()), thread1, SLOT(quit()), Qt::DirectConnection);
connect(mySearch, SIGNAL(finishedscan()), thread2, SLOT(quit()), Qt::DirectConnection);


But, it seems that only one is activated. How should I activate both. Please let me know with an example.



Thanks.










share|improve this question














Hi I have a class named search and this class has two member functions. The consumer and the producer. This is the way I have activated these functions as two threads in qt.



thread1 = new QThread();
thread2 = new QThread();
mySearch = new Search() ;

mySearch->moveToThread(thread1);

mySearch->moveToThread(thread2);


connect(mySearch, SIGNAL(workRequested()), thread1, SLOT(start()));
connect(mySearch, SIGNAL(workRequested()), thread2, SLOT(start()));

connect(thread1, SIGNAL(started()),mySearch, SLOT(producer()));
connect(thread2, SIGNAL(started()),mySearch, SLOT(consumer()));

connect(mySearch, SIGNAL(finishedscan()), thread1, SLOT(quit()), Qt::DirectConnection);
connect(mySearch, SIGNAL(finishedscan()), thread2, SLOT(quit()), Qt::DirectConnection);


But, it seems that only one is activated. How should I activate both. Please let me know with an example.



Thanks.







qt class qthread






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 21 '18 at 14:09









zahrazahra

3218




3218








  • 3





    A QObject can only "live" in a single thread. Thats by definition. You could create a wrapper around "Search" and let each wrapper live in a seperate thread

    – Felix
    Nov 21 '18 at 14:32











  • Thanks. I have a common circular buffer between these two threads. Will the consumer thread follow the changes of the buffer made by the producer if I define separate wrappers for each thread? If I write the two functions in two different classes then were should I define the common circular buffer? In the producer class or the consumer class? @Felix

    – zahra
    Nov 26 '18 at 5:51
















  • 3





    A QObject can only "live" in a single thread. Thats by definition. You could create a wrapper around "Search" and let each wrapper live in a seperate thread

    – Felix
    Nov 21 '18 at 14:32











  • Thanks. I have a common circular buffer between these two threads. Will the consumer thread follow the changes of the buffer made by the producer if I define separate wrappers for each thread? If I write the two functions in two different classes then were should I define the common circular buffer? In the producer class or the consumer class? @Felix

    – zahra
    Nov 26 '18 at 5:51










3




3





A QObject can only "live" in a single thread. Thats by definition. You could create a wrapper around "Search" and let each wrapper live in a seperate thread

– Felix
Nov 21 '18 at 14:32





A QObject can only "live" in a single thread. Thats by definition. You could create a wrapper around "Search" and let each wrapper live in a seperate thread

– Felix
Nov 21 '18 at 14:32













Thanks. I have a common circular buffer between these two threads. Will the consumer thread follow the changes of the buffer made by the producer if I define separate wrappers for each thread? If I write the two functions in two different classes then were should I define the common circular buffer? In the producer class or the consumer class? @Felix

– zahra
Nov 26 '18 at 5:51







Thanks. I have a common circular buffer between these two threads. Will the consumer thread follow the changes of the buffer made by the producer if I define separate wrappers for each thread? If I write the two functions in two different classes then were should I define the common circular buffer? In the producer class or the consumer class? @Felix

– zahra
Nov 26 '18 at 5:51














1 Answer
1






active

oldest

votes


















0














This is a simple example to run the two methods of the same object in two different threads. Assuming your Search class looks like this:



class Search : public QObject
{
Q_OBJECT

public:
void producer();
void consumer();

signals:
void workRequested();
void finishedscan();
};


You would create a second class like this:



class Worker : public QObject
{
Q_OBJECT

public:
Worker(std::function<void()> task) :
QObject{},
_task{std::move(task)}
{}

public slots:
void work() {
_task();
}

private:
std::function<void()> _task;
};


And now you can implement the start:



thread1 = new QThread();
thread2 = new QThread();
mySearch = new Search();
auto worker1 = new Worker(std::bind(&Search::producer, mySearch));
auto worker2 = new Worker(std::bind(&Search::consumer, mySearch));

worker1->moveToThread(thread1);
worker2->moveToThread(thread2);

connect(mySearch, SIGNAL(workRequested()), thread1, SLOT(start()));
connect(mySearch, SIGNAL(workRequested()), thread2, SLOT(start()));

connect(thread1, SIGNAL(started()),worker1, SLOT(work()));
connect(thread2, SIGNAL(started()),worker2, SLOT(work()));

connect(mySearch, SIGNAL(finishedscan()), thread1, SLOT(quit()), Qt::DirectConnection);
connect(mySearch, SIGNAL(finishedscan()), thread2, SLOT(quit()), Qt::DirectConnection);


Important: While this solution solves how to start the two tasks on different threads, stopping won't work yet as QThread::quit only works if the thread returns to the eventloop! If your producer/consumer methods do not return to the eventloop and use it to perform tasks, write so in the comments and I will update the answer to handle that case as well.





EDIT: Since stopping i the above solution only works, if producer/consumer return to the eventloop - which is not the case according to OP, you have to manually notify the worker that it should stop working to gracefully quit the thread.



For the first solution, your worker has to periodically check, if it should stop working. For example:



MySearch::producer() {
while(!QThread::currentThread()->isInterruptionRequested() {
//do some work
}
}


And secondly, you have to adjust how you quit the thread:



connect(mySearch, &MySearch::finishedscan, thread1, [thread1](){
thread1->requestInterruption();
thread1->quit();
}, Qt::DirectConnection);


Note: Regardless of how you quit your threads, you should always wait for them in the main thread to finish their work before exiting:



thread1->wait();


Finally, you mentioned in the comments that you use CTRL+C to quit the application - make shure to register a signal handler to catch SIGINT and stop you application gracefully, as the default SIGINT will just terminate it, without proper cleanup






share|improve this answer


























  • Thanks for your response. I don't exactly understand what you mean by event loop. Both the producer and consumer thread keep on working until I use ctrl+c. The producer fills the buffer and the consumer reads the buffer and shows the values in a Qtable @Felix

    – zahra
    Nov 28 '18 at 9:08











  • In that case, using quit will not work (you should really read on QThread to understand how it works). You can either use terminate or use logic inside the worker to handle the quit. I will update the answer

    – Felix
    Nov 28 '18 at 9:47











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53413916%2fhow-to-run-two-functions-of-the-same-class-in-different-threads%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














This is a simple example to run the two methods of the same object in two different threads. Assuming your Search class looks like this:



class Search : public QObject
{
Q_OBJECT

public:
void producer();
void consumer();

signals:
void workRequested();
void finishedscan();
};


You would create a second class like this:



class Worker : public QObject
{
Q_OBJECT

public:
Worker(std::function<void()> task) :
QObject{},
_task{std::move(task)}
{}

public slots:
void work() {
_task();
}

private:
std::function<void()> _task;
};


And now you can implement the start:



thread1 = new QThread();
thread2 = new QThread();
mySearch = new Search();
auto worker1 = new Worker(std::bind(&Search::producer, mySearch));
auto worker2 = new Worker(std::bind(&Search::consumer, mySearch));

worker1->moveToThread(thread1);
worker2->moveToThread(thread2);

connect(mySearch, SIGNAL(workRequested()), thread1, SLOT(start()));
connect(mySearch, SIGNAL(workRequested()), thread2, SLOT(start()));

connect(thread1, SIGNAL(started()),worker1, SLOT(work()));
connect(thread2, SIGNAL(started()),worker2, SLOT(work()));

connect(mySearch, SIGNAL(finishedscan()), thread1, SLOT(quit()), Qt::DirectConnection);
connect(mySearch, SIGNAL(finishedscan()), thread2, SLOT(quit()), Qt::DirectConnection);


Important: While this solution solves how to start the two tasks on different threads, stopping won't work yet as QThread::quit only works if the thread returns to the eventloop! If your producer/consumer methods do not return to the eventloop and use it to perform tasks, write so in the comments and I will update the answer to handle that case as well.





EDIT: Since stopping i the above solution only works, if producer/consumer return to the eventloop - which is not the case according to OP, you have to manually notify the worker that it should stop working to gracefully quit the thread.



For the first solution, your worker has to periodically check, if it should stop working. For example:



MySearch::producer() {
while(!QThread::currentThread()->isInterruptionRequested() {
//do some work
}
}


And secondly, you have to adjust how you quit the thread:



connect(mySearch, &MySearch::finishedscan, thread1, [thread1](){
thread1->requestInterruption();
thread1->quit();
}, Qt::DirectConnection);


Note: Regardless of how you quit your threads, you should always wait for them in the main thread to finish their work before exiting:



thread1->wait();


Finally, you mentioned in the comments that you use CTRL+C to quit the application - make shure to register a signal handler to catch SIGINT and stop you application gracefully, as the default SIGINT will just terminate it, without proper cleanup






share|improve this answer


























  • Thanks for your response. I don't exactly understand what you mean by event loop. Both the producer and consumer thread keep on working until I use ctrl+c. The producer fills the buffer and the consumer reads the buffer and shows the values in a Qtable @Felix

    – zahra
    Nov 28 '18 at 9:08











  • In that case, using quit will not work (you should really read on QThread to understand how it works). You can either use terminate or use logic inside the worker to handle the quit. I will update the answer

    – Felix
    Nov 28 '18 at 9:47
















0














This is a simple example to run the two methods of the same object in two different threads. Assuming your Search class looks like this:



class Search : public QObject
{
Q_OBJECT

public:
void producer();
void consumer();

signals:
void workRequested();
void finishedscan();
};


You would create a second class like this:



class Worker : public QObject
{
Q_OBJECT

public:
Worker(std::function<void()> task) :
QObject{},
_task{std::move(task)}
{}

public slots:
void work() {
_task();
}

private:
std::function<void()> _task;
};


And now you can implement the start:



thread1 = new QThread();
thread2 = new QThread();
mySearch = new Search();
auto worker1 = new Worker(std::bind(&Search::producer, mySearch));
auto worker2 = new Worker(std::bind(&Search::consumer, mySearch));

worker1->moveToThread(thread1);
worker2->moveToThread(thread2);

connect(mySearch, SIGNAL(workRequested()), thread1, SLOT(start()));
connect(mySearch, SIGNAL(workRequested()), thread2, SLOT(start()));

connect(thread1, SIGNAL(started()),worker1, SLOT(work()));
connect(thread2, SIGNAL(started()),worker2, SLOT(work()));

connect(mySearch, SIGNAL(finishedscan()), thread1, SLOT(quit()), Qt::DirectConnection);
connect(mySearch, SIGNAL(finishedscan()), thread2, SLOT(quit()), Qt::DirectConnection);


Important: While this solution solves how to start the two tasks on different threads, stopping won't work yet as QThread::quit only works if the thread returns to the eventloop! If your producer/consumer methods do not return to the eventloop and use it to perform tasks, write so in the comments and I will update the answer to handle that case as well.





EDIT: Since stopping i the above solution only works, if producer/consumer return to the eventloop - which is not the case according to OP, you have to manually notify the worker that it should stop working to gracefully quit the thread.



For the first solution, your worker has to periodically check, if it should stop working. For example:



MySearch::producer() {
while(!QThread::currentThread()->isInterruptionRequested() {
//do some work
}
}


And secondly, you have to adjust how you quit the thread:



connect(mySearch, &MySearch::finishedscan, thread1, [thread1](){
thread1->requestInterruption();
thread1->quit();
}, Qt::DirectConnection);


Note: Regardless of how you quit your threads, you should always wait for them in the main thread to finish their work before exiting:



thread1->wait();


Finally, you mentioned in the comments that you use CTRL+C to quit the application - make shure to register a signal handler to catch SIGINT and stop you application gracefully, as the default SIGINT will just terminate it, without proper cleanup






share|improve this answer


























  • Thanks for your response. I don't exactly understand what you mean by event loop. Both the producer and consumer thread keep on working until I use ctrl+c. The producer fills the buffer and the consumer reads the buffer and shows the values in a Qtable @Felix

    – zahra
    Nov 28 '18 at 9:08











  • In that case, using quit will not work (you should really read on QThread to understand how it works). You can either use terminate or use logic inside the worker to handle the quit. I will update the answer

    – Felix
    Nov 28 '18 at 9:47














0












0








0







This is a simple example to run the two methods of the same object in two different threads. Assuming your Search class looks like this:



class Search : public QObject
{
Q_OBJECT

public:
void producer();
void consumer();

signals:
void workRequested();
void finishedscan();
};


You would create a second class like this:



class Worker : public QObject
{
Q_OBJECT

public:
Worker(std::function<void()> task) :
QObject{},
_task{std::move(task)}
{}

public slots:
void work() {
_task();
}

private:
std::function<void()> _task;
};


And now you can implement the start:



thread1 = new QThread();
thread2 = new QThread();
mySearch = new Search();
auto worker1 = new Worker(std::bind(&Search::producer, mySearch));
auto worker2 = new Worker(std::bind(&Search::consumer, mySearch));

worker1->moveToThread(thread1);
worker2->moveToThread(thread2);

connect(mySearch, SIGNAL(workRequested()), thread1, SLOT(start()));
connect(mySearch, SIGNAL(workRequested()), thread2, SLOT(start()));

connect(thread1, SIGNAL(started()),worker1, SLOT(work()));
connect(thread2, SIGNAL(started()),worker2, SLOT(work()));

connect(mySearch, SIGNAL(finishedscan()), thread1, SLOT(quit()), Qt::DirectConnection);
connect(mySearch, SIGNAL(finishedscan()), thread2, SLOT(quit()), Qt::DirectConnection);


Important: While this solution solves how to start the two tasks on different threads, stopping won't work yet as QThread::quit only works if the thread returns to the eventloop! If your producer/consumer methods do not return to the eventloop and use it to perform tasks, write so in the comments and I will update the answer to handle that case as well.





EDIT: Since stopping i the above solution only works, if producer/consumer return to the eventloop - which is not the case according to OP, you have to manually notify the worker that it should stop working to gracefully quit the thread.



For the first solution, your worker has to periodically check, if it should stop working. For example:



MySearch::producer() {
while(!QThread::currentThread()->isInterruptionRequested() {
//do some work
}
}


And secondly, you have to adjust how you quit the thread:



connect(mySearch, &MySearch::finishedscan, thread1, [thread1](){
thread1->requestInterruption();
thread1->quit();
}, Qt::DirectConnection);


Note: Regardless of how you quit your threads, you should always wait for them in the main thread to finish their work before exiting:



thread1->wait();


Finally, you mentioned in the comments that you use CTRL+C to quit the application - make shure to register a signal handler to catch SIGINT and stop you application gracefully, as the default SIGINT will just terminate it, without proper cleanup






share|improve this answer















This is a simple example to run the two methods of the same object in two different threads. Assuming your Search class looks like this:



class Search : public QObject
{
Q_OBJECT

public:
void producer();
void consumer();

signals:
void workRequested();
void finishedscan();
};


You would create a second class like this:



class Worker : public QObject
{
Q_OBJECT

public:
Worker(std::function<void()> task) :
QObject{},
_task{std::move(task)}
{}

public slots:
void work() {
_task();
}

private:
std::function<void()> _task;
};


And now you can implement the start:



thread1 = new QThread();
thread2 = new QThread();
mySearch = new Search();
auto worker1 = new Worker(std::bind(&Search::producer, mySearch));
auto worker2 = new Worker(std::bind(&Search::consumer, mySearch));

worker1->moveToThread(thread1);
worker2->moveToThread(thread2);

connect(mySearch, SIGNAL(workRequested()), thread1, SLOT(start()));
connect(mySearch, SIGNAL(workRequested()), thread2, SLOT(start()));

connect(thread1, SIGNAL(started()),worker1, SLOT(work()));
connect(thread2, SIGNAL(started()),worker2, SLOT(work()));

connect(mySearch, SIGNAL(finishedscan()), thread1, SLOT(quit()), Qt::DirectConnection);
connect(mySearch, SIGNAL(finishedscan()), thread2, SLOT(quit()), Qt::DirectConnection);


Important: While this solution solves how to start the two tasks on different threads, stopping won't work yet as QThread::quit only works if the thread returns to the eventloop! If your producer/consumer methods do not return to the eventloop and use it to perform tasks, write so in the comments and I will update the answer to handle that case as well.





EDIT: Since stopping i the above solution only works, if producer/consumer return to the eventloop - which is not the case according to OP, you have to manually notify the worker that it should stop working to gracefully quit the thread.



For the first solution, your worker has to periodically check, if it should stop working. For example:



MySearch::producer() {
while(!QThread::currentThread()->isInterruptionRequested() {
//do some work
}
}


And secondly, you have to adjust how you quit the thread:



connect(mySearch, &MySearch::finishedscan, thread1, [thread1](){
thread1->requestInterruption();
thread1->quit();
}, Qt::DirectConnection);


Note: Regardless of how you quit your threads, you should always wait for them in the main thread to finish their work before exiting:



thread1->wait();


Finally, you mentioned in the comments that you use CTRL+C to quit the application - make shure to register a signal handler to catch SIGINT and stop you application gracefully, as the default SIGINT will just terminate it, without proper cleanup







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 28 '18 at 9:58

























answered Nov 26 '18 at 10:58









FelixFelix

4,78011940




4,78011940













  • Thanks for your response. I don't exactly understand what you mean by event loop. Both the producer and consumer thread keep on working until I use ctrl+c. The producer fills the buffer and the consumer reads the buffer and shows the values in a Qtable @Felix

    – zahra
    Nov 28 '18 at 9:08











  • In that case, using quit will not work (you should really read on QThread to understand how it works). You can either use terminate or use logic inside the worker to handle the quit. I will update the answer

    – Felix
    Nov 28 '18 at 9:47



















  • Thanks for your response. I don't exactly understand what you mean by event loop. Both the producer and consumer thread keep on working until I use ctrl+c. The producer fills the buffer and the consumer reads the buffer and shows the values in a Qtable @Felix

    – zahra
    Nov 28 '18 at 9:08











  • In that case, using quit will not work (you should really read on QThread to understand how it works). You can either use terminate or use logic inside the worker to handle the quit. I will update the answer

    – Felix
    Nov 28 '18 at 9:47

















Thanks for your response. I don't exactly understand what you mean by event loop. Both the producer and consumer thread keep on working until I use ctrl+c. The producer fills the buffer and the consumer reads the buffer and shows the values in a Qtable @Felix

– zahra
Nov 28 '18 at 9:08





Thanks for your response. I don't exactly understand what you mean by event loop. Both the producer and consumer thread keep on working until I use ctrl+c. The producer fills the buffer and the consumer reads the buffer and shows the values in a Qtable @Felix

– zahra
Nov 28 '18 at 9:08













In that case, using quit will not work (you should really read on QThread to understand how it works). You can either use terminate or use logic inside the worker to handle the quit. I will update the answer

– Felix
Nov 28 '18 at 9:47





In that case, using quit will not work (you should really read on QThread to understand how it works). You can either use terminate or use logic inside the worker to handle the quit. I will update the answer

– Felix
Nov 28 '18 at 9:47




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53413916%2fhow-to-run-two-functions-of-the-same-class-in-different-threads%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

鏡平學校

ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

Why https connections are so slow when debugging (stepping over) in Java?