This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Patch to mutex.c
- To: libc-alpha at sources dot redhat dot com
- Subject: Re: Patch to mutex.c
- From: Neale dot Ferguson at softwareAG-usa dot com
- Date: Wed, 27 Sep 2000 13:04:14 +0200
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.