Hi, On Wednesday, Wednesday 05 March 2014 at 14:50, Firl, Benjamin wrote: > we make heavy use of Qt in our software and are now trying to use llvm > thread sanitizer for debugging. Unfortunately the sanitizer doesn't seem > to recognize QMutex as a locking mechanism.
That's because on Linux it does not use classic locking mechanisms - it uses
atomic operations on a memory location and futexes to wait on them and to wake
up other threads when freeing the mutex.
Valgrind is confused by this as well...
The upside of that implementation is that it is a lot faster, while being just
as safe.
> The example below warns about
> a race condition because the member "data" is accessed in two threads. If
> you use a boost::mutex instead, the warning disappears.
Because boost likely uses pthread_mutex, which is recognized by almost all the
toolkits that analyze thread locking.
If you ever find out how to tell LLVM about QMutex - let me know. ;-)
> If "data" is a
> global variable, the false warning is also not shown.
I think you should report this as a bug to LLVM. There really is no difference
between protecting global and heap objects. So LLVM should display the same
warning here.
Konrad
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest
