Except in this particular case where:
- The flag is set to false at the start of the thread
- Set to true for stopping by the controlling(parent) thread (writen,
never read)
- Checked by the thread as a quit condition (read, never written)
In that case, there is absolutely no possible race cond
On sábado, 22 de junho de 2013 12.41.10, Tony Rietwyk wrote:
> But a bool value can be cached indefinitely, so make sure you declare the
> flag as volatile!
That's wrong and has been explained away several times. You need to declare it
as atomic, not as volatile.
--
Thiago Macieira - thiago.macie
2013 9:01 PM
Cc: interest@qt-project.org
Subject: Re: [Interest] Terminating a QThread
Sorry Mandeep, I didn't read your post first. Basically what I posted is
similar.
A mutex is a little bit overkill here, you could use an atomic variable if you
want to be sure, but just a bool flag wi
Hi,
This was my case, but after a careful study of how the event loop and
queued signal/slot connection works, I figured it out and everything works
cleanly now.
It's easy to have this issue, as if you ask the thread to quit via a
signal/slot, you have to ensure that nothing is destroyed or blocke
Am Fri, 21 Jun 2013 15:50:16 +0200
schrieb Etienne Sandré-Chardonnal :
> Well, after a quick test, it seems that terminate is not working under
> windows (at least, not working as expected by reading the manual).
>
just to put in my 2 windows cents:
sometimes my threads even don't stop when i qu
:* Etienne Sandré-Chardonnal
> *À :*
> *Cc :* "interest@qt-project.org"
> *Envoyé le :* Vendredi 21 juin 2013 13h00
> *Objet :* Re: [Interest] Terminating a QThread
>
> Sorry Mandeep, I didn't read your post first. Basically what I posted is
> similar.
>
>
.
I was just hoping that someone that knows well QThread would help me to
understand.
François
De : André Somers
À : interest@qt-project.org
Envoyé le : Vendredi 21 juin 2013 14h12
Objet : Re: [Interest] Terminating a QThread
Op 21-6-2013 10:06, francois
Op 21-6-2013 10:06, francois cellier schreef:
Dear all,
Even if I know that it can be dangerous to terminate a thread, I need
to do it for my application.
Are you really going to completely re-do the discussion you already had
on the qt-project.org forums?
André
--
You like Qt?
I am looking
know why the terminate function does not terminate my thread if an
eventloop is running.
De : Etienne Sandré-Chardonnal
À :
Cc : "interest@qt-project.org"
Envoyé le : Vendredi 21 juin 2013 13h00
Objet : Re: [Interest] Terminating a QThread
Sor
Sorry Mandeep, I didn't read your post first. Basically what I posted is
similar.
A mutex is a little bit overkill here, you could use an atomic variable if
you want to be sure, but just a bool flag will be enough as it is always
set atomically AFAIK
2013/6/21 Mandeep Sandhu
> On Fri, Jun 21,
The best is still not to terminate threads if not absolutely necessary.
Even without an event loop, you can poll a flag that asks the thread to
return from the run function.
For instance:
void RenderThread::run()
{
while(!stopRequested)
{
//Do some intensive calcul
On Fri, Jun 21, 2013 at 1:36 PM, francois cellier wrote:
> Dear all,
>
> Even if I know that it can be dangerous to terminate a thread, I need to
> do it for my application.
> The function that run into the thread is like a long linear sequence of
> code that has not been designed in a signal/slot
Dear all,
Even if I know that it can be dangerous to terminate a thread, I need to do it
for my application.
The function that run into the thread is like a long linear sequence of code
that has not been designed in a signal/slot way. Moreover, in my thread, I need
an eventloop as I use in it s
13 matches
Mail list logo