[llvm-commits] [llvm] r73803 - in /llvm/trunk/include/llvm/System: Mutex.h RWMutex.h
Török Edwin
edwintorok at gmail.com
Fri Jun 19 23:48:56 PDT 2009
On 2009-06-20 03:27, Owen Anderson wrote:
> Author: resistor
> Date: Fri Jun 19 19:27:21 2009
> New Revision: 73803
>
> URL: http://llvm.org/viewvc/llvm-project?rev=73803&view=rev
> Log:
> Add debugging code to test for various locking faux-pas's, when running in single threaded mode. This should help improve testing coverage for
> threading support, without having extensive actually concurrent clients yet.
>
> Modified:
> llvm/trunk/include/llvm/System/Mutex.h
> llvm/trunk/include/llvm/System/RWMutex.h
>
> Modified: llvm/trunk/include/llvm/System/Mutex.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Mutex.h?rev=73803&r1=73802&r2=73803&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/System/Mutex.h (original)
> +++ llvm/trunk/include/llvm/System/Mutex.h Fri Jun 19 19:27:21 2009
> @@ -15,6 +15,7 @@
> #define LLVM_SYSTEM_MUTEX_H
>
> #include "llvm/System/Threading.h"
> +#include <cassert>
>
> namespace llvm
> {
> @@ -85,18 +86,32 @@
> /// running in multithreaded mode.
> template<bool mt_only>
> class SmartMutex : public MutexImpl {
> + unsigned acquired;
> + bool recursive;
> public:
> - explicit SmartMutex(bool recursive = true) : MutexImpl(recursive) { }
> + explicit SmartMutex(bool rec = true) :
> + MutexImpl(rec), acquired(0), recursive(rec) { }
>
> bool acquire() {
> if (!mt_only || llvm_is_multithreaded())
> return MutexImpl::acquire();
> +
> + // Single-threaded debugging code. This would be racy in multithreaded
> + // mode, but provides not sanity checks in single threaded mode.
>
What did you mean by "provides not"?
Best regards,
--Edwin
More information about the llvm-commits
mailing list