Boost::Thread: Joining without waiting

H

Hans Mull

Hi!
I'm experimenting with boost::thread. I have a GUI application with a
slot function:

void someFunction(){...}
void Frame::OnOkButtonClick(...)
{
switch(someInteger)
{
case 0: break
case 1:
{
boost::thread mthTread(&someFunction);
mthTread.join();
break;
}
default: break
}
}

The program compiles and runs properly, but the GUI doesn't react
(Well, this is what to expect with this code because it waits for the
Thread to finish).
How can I make the program not to wait until the thread is finished?
Thanks in advance!

Kind regards, Hans
 
M

Michael DOUBEZ

Hans Mull a écrit :
Hi!
I'm experimenting with boost::thread. I have a GUI application with a
slot function:

void someFunction(){...}
void Frame::OnOkButtonClick(...)
{
switch(someInteger)
{
case 0: break
case 1:
{
boost::thread mthTread(&someFunction);
mthTread.join();
break;
}
default: break
}
}

The program compiles and runs properly, but the GUI doesn't react
(Well, this is what to expect with this code because it waits for the
Thread to finish).
How can I make the program not to wait until the thread is finished?

Don't call join(). The thread will remain in detached state.

Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,961
Messages
2,570,131
Members
46,689
Latest member
liammiller

Latest Threads

Top