This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch to mutex.c


Your patch is fine with me. I'll apply it and let her rip.

Many thanks!


> This patch isn't quite right because EPERM must be returned if the mutex
> owned by the calling thread, not just when it is not owned.  The above
> will not detect the case when the mutex is owned by another thread.
> You need the following test:
>
>         if (mutex->__m_owner != thread_self())
>             return EPERM;
>
> This test should be done first, before doing anything which may change the
> state of the mutex. You don't want to be decrementing the lock count if
> you're not the owner.
>
> Inserting the above test as the first statement of the case is a complete
> solution to the non-compliance.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]