[llvm-commits] [llvm] r73711 - /llvm/trunk/include/llvm/System/Mutex.h
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Fri Jun 19 09:16:51 PDT 2009
Hi Owen,
This patch makes multithreaded applications do lots of sigsegvs, even if
I call start_multithread at the beginning of my main function. I haven't
looked at why yet, only tracked the error down to this revision. Could
you double-check your code?
Thanks!
Nicolas
Owen Anderson wrote:
> Author: resistor
> Date: Thu Jun 18 13:29:03 2009
> New Revision: 73711
>
> URL: http://llvm.org/viewvc/llvm-project?rev=73711&view=rev
> Log:
> Simplify the SmartMutex implementation a bit.
>
> Modified:
> llvm/trunk/include/llvm/System/Mutex.h
>
> Modified: llvm/trunk/include/llvm/System/Mutex.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Mutex.h?rev=73711&r1=73710&r2=73711&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/System/Mutex.h (original)
> +++ llvm/trunk/include/llvm/System/Mutex.h Thu Jun 18 13:29:03 2009
> @@ -86,31 +86,30 @@
> /// indicates whether this mutex should become a no-op when we're not
> /// running in multithreaded mode.
> template<bool mt_only>
> - class SmartMutex {
> - MutexImpl mtx;
> + class SmartMutex : public MutexImpl {
> public:
> - explicit SmartMutex(bool recursive = true) : mtx(recursive) { }
> + explicit SmartMutex(bool recursive = true) : MutexImpl(recursive) { }
>
> bool acquire() {
> - if (!mt_only || (mt_only && llvm_is_multithreaded()))
> - return mtx.acquire();
> + if (!mt_only && llvm_is_multithreaded())
> + return MutexImpl::acquire();
> return true;
> }
>
> bool release() {
> - if (!mt_only || (mt_only && llvm_is_multithreaded()))
> - return mtx.release();
> + if (!mt_only || llvm_is_multithreaded())
> + return MutexImpl::release();
> return true;
> }
>
> bool tryacquire() {
> - if (!mt_only || (mt_only && llvm_is_multithreaded()))
> - return mtx.tryacquire();
> + if (!mt_only || llvm_is_multithreaded())
> + return MutexImpl::tryacquire();
> return true;
> }
>
> private:
> - SmartMutex<mt_only>(const SmartMutex<mt_only> & original);
> + SmartMutex(const SmartMutex<mt_only> & original);
> void operator=(const SmartMutex<mt_only> &);
> };
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
More information about the llvm-commits
mailing list