[sldev] OSX mutex-related lockups

Soft Linden soft at lindenlab.com
Sun Aug 5 09:09:27 PDT 2007


On 8/4/07, Trevor Powell <trevor at gridbug.org> wrote:
>
> While testing various patches in an OS X build, I've noticed an issue
> with mutexes.  Inside llthread.cpp, line 269, llMutexes create their
> internal mutex objects using the "APR_THREAD_MUTEX_DEFAULT" mutex
> behaviour.
>
> Apparently, under Win32 (I'm reliably informed), this default
> behaviour is the equivalent of APR_THREAD_MUTEX_NESTED, whereas under
> OSX (I've determined through testing), it's the equivalent of
> APR_THREAD_MUTEX_UNNESTED.  I haven't tested under Linux, but I
> suspect that it's probably treated as UNNESTED there, as well.
>
>
> So this means that if code within a single thread tries to lock a
> single llMutex twice before unlocking it again, it will appear to run
> correctly in all Win32 builds, but will cause a lockup when that same
> code runs under OS X.

The two should definitely have the same behavior here. This sounds
like a design flaw at the least -- definitely patchworthy.


> In my local build, I've modified the llMutex class to explicitly
> request the 'NESTED' mutex type, and this seems to have resolved a
> couple of frequent OS X lockups I've suffered while testing various
> patches.

Is any of it reproducible, or were the patches in any way related?


> I figure that anything which makes the different platforms
> work more in the same way can only be a good thing, right?

So long as it's moving more things toward the correct implementation, sure. :)


More information about the SLDev mailing list