[lldb-dev] All windows Mutex objects are recursive???

Tamas Berghammer via lldb-dev lldb-dev at lists.llvm.org
Thu May 12 05:24:02 PDT 2016


We already use both std::mutex and std::condition_variable
in include/lldb/Utility/TaskPool.h for a while (since October) and nobody
complained about it so I think we can safely assume that all platform has
the necessary STL support.

On Wed, May 11, 2016 at 11:44 PM Greg Clayton via lldb-dev <
lldb-dev at lists.llvm.org> wrote:

> It would be nice to get a patch that gets rid of the Mutex.h/Mutex.cpp and
> switches over to using C++11 std::mutex/std::recursive_mutex and get rid of
> Condition.h/Condition.cpp for std::condition_variable. Then we can be more
> consistent. We need to make sure the C++ standard libraries are ready on
> all platforms first though.
>
> Greg
>
> > On May 11, 2016, at 3:01 PM, Zachary Turner <zturner at google.com> wrote:
> >
> > I mean std::recursive_mutex is recursive
> >
> > On Wed, May 11, 2016 at 3:01 PM Zachary Turner <zturner at google.com>
> wrote:
> > Yes, eventually we should move to std::mutex and
> std::condition_variable, in which case it behaves as expected (std::mutex
> is non recursive, std::mutex is recursive).
> >
> >
> >
> > On Wed, May 11, 2016 at 2:20 PM Greg Clayton via lldb-dev <
> lldb-dev at lists.llvm.org> wrote:
> > From lldb/source/Host/windows/Mutex.cpp:
> >
> >
> > Mutex::Mutex () :
> >     m_mutex()
> > {
> >     m_mutex =
> static_cast<PCRITICAL_SECTION>(malloc(sizeof(CRITICAL_SECTION)));
> >     InitializeCriticalSection(static_cast<PCRITICAL_SECTION>(m_mutex));
> > }
> >
> > //----------------------------------------------------------------------
> > // Default constructor.
> > //
> > // Creates a pthread mutex with "type" as the mutex type.
> > //----------------------------------------------------------------------
> > Mutex::Mutex (Mutex::Type type) :
> >     m_mutex()
> > {
> >     m_mutex =
> static_cast<PCRITICAL_SECTION>(malloc(sizeof(CRITICAL_SECTION)));
> >     InitializeCriticalSection(static_cast<PCRITICAL_SECTION>(m_mutex));
> > }
> >
> >
> > It also means that Condition.cpp doesn't act like its unix counterpart
> as the pthread_contition_t requires that wait be called with a non
> recursive mutex. Not sure what or if any issues are resulting from this,
> but I just thought everyone should be aware.
> >
> > Greg Clayton
> >
> > _______________________________________________
> > lldb-dev mailing list
> > lldb-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20160512/493c7630/attachment.html>


More information about the lldb-dev mailing list