[Interest] Best way to terminate threads using QWaitCondition
Bob Hood
bhood2 at comcast.net
Sun Nov 22 04:01:05 CET 2015
On 11/21/2015 2:26 PM, Bob Hood wrote:
> On 11/21/2015 1:26 PM, Thiago Macieira wrote:
>>> that are synchronizing using QMutex/QWaitCondition. In my working
>>> code, I'm getting error messages that look like:
>>>
>>> QWaitCondition: cv destroy failure: Device or resource busy
>>> QWaitCondition: mutex destroy failure: Device or resource busy
>> What's the backtrace of those warnings? Which thread were they printed from?
>
> I'm getting them from the child process that has the threads. The process
> is being launched from a parent using QProcess. I'm trapping the child's
> stdout and stderr, and these are coming through on the stderr.
>
> I'll attach at debugger to the child and see if I can pinpoint the thread.
Well, my Debugging-fu under Linux is not quite as good yet as it is under
Windows. I cannot pin down the precise thread that might be causing this, or
even the point in time. However, my gut tells me that it's a race condition
where the variables (QMutex/QWaitCondition) are being destroyed before the
threads are terminated.
I'm going to try some refactoring of the threading model to see if I can
address it that way. This is my first use of wait conditions (although I've
used a similar synchronization model in Python). It's a great approach to
thread synchronization, but it's turning out to be tricky. :)
Thanks for the help, Thiago. I'll get back to you if I can't address it some
other way.
More information about the Interest
mailing list