Agustina Arzille, on Sun 29 Jan 2017 21:11:12 -0300, wrote:
On 2017-01-29 17:44, Samuel Thibault wrote:
>Agustina Arzille, on Sun 29 Jan 2017 16:46:45 -0300, wrote:
>
>There is just one thing I'm a bit afraid of: the code is assuming that
>the only reason why the locker thread is awakened is that it was given
>the mutex control. Is that guaranteed?
Well, the locker thread checks the wait_result value: If it's
THREAD_AWAKENED,
it assumes that control of the mutex was transferred to it; otherwise,
it
assumes it was interrupted. I *think* that's good enough.
But what if some other thread, completely unrelated to the mutex, wakes
the locker thread, for whatever reason unrelated to the mutex?
Yes, "any" here is important, I'd say, otherwise one could think that
it's only one thread we have missed, while we actually have checked for
all of them.