Patch to mutex.c
Neale.Ferguson@softwareAG-usa.com
Neale.Ferguson@softwareAG-usa.com
Wed Sep 27 10:08:00 GMT 2000
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.
More information about the Libc-alpha
mailing list