#
c8404e7b |
|
03-Jan-2017 |
Mark Seaborn <mseaborn@google.com> |
[ulib] mtx_timedlock(): Partly fix absolute->relative timeout calculation When a timedlock() operation is implemented using an absolute-to-relative timeout calculation, this calculation must be redone every time we do a futex_wait(). This is because when our futex_wait() call returns, the mutex could have been claimed by another thread, so that we'll have to wait again. If our timeout was for 10 seconds, we don't want our second futex_wait to be for the full 10 seconds. So, move the calculation into timedlock()'s loop. Also rename mxr_mutex_timedlock() to add a "__" prefix, to indicate that it shouldn't be used except by mtx_timedlock(). (timedlock() operations aren't used very much anyway, and mxr_mutex_* is currently only used to implement mtx_*.) This change will also make it easier to convert this mutex implementation to use a more efficient 3-state mutex instead of a 2-state mutex. MG-361 Change-Id: I8d30b83be05f3f11a923ab59fa149375f3909632
|