Some style fixes inspired by @bde.

This commit is contained in:
David Xu 2012-08-11 23:48:39 +00:00
parent e1252ce1d2
commit d7f97db7bd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=239202

View File

@ -587,7 +587,7 @@ abs_timeout_init2(struct abs_timeout *timo, const struct _umtx_time *umtxtime)
&umtxtime->_timeout); &umtxtime->_timeout);
} }
static void static inline void
abs_timeout_update(struct abs_timeout *timo) abs_timeout_update(struct abs_timeout *timo)
{ {
kern_clock_gettime(curthread, timo->clockid, &timo->cur); kern_clock_gettime(curthread, timo->clockid, &timo->cur);
@ -598,10 +598,10 @@ abs_timeout_gethz(struct abs_timeout *timo)
{ {
struct timespec tts; struct timespec tts;
if (timespeccmp(&timo->end, &timo->cur, <=))
return (-1);
tts = timo->end; tts = timo->end;
timespecsub(&tts, &timo->cur); timespecsub(&tts, &timo->cur);
if (tts.tv_sec < 0 || (tts.tv_sec == 0 && tts.tv_nsec == 0))
return (-1);
return (tstohz(&tts)); return (tstohz(&tts));
} }
@ -610,29 +610,29 @@ abs_timeout_gethz(struct abs_timeout *timo)
* thread was removed from umtx queue. * thread was removed from umtx queue.
*/ */
static inline int static inline int
umtxq_sleep(struct umtx_q *uq, const char *wmesg, struct abs_timeout *timo) umtxq_sleep(struct umtx_q *uq, const char *wmesg, struct abs_timeout *abstime)
{ {
struct umtxq_chain *uc; struct umtxq_chain *uc;
int error; int error, timo;
int pulse;
uc = umtxq_getchain(&uq->uq_key); uc = umtxq_getchain(&uq->uq_key);
UMTXQ_LOCKED_ASSERT(uc); UMTXQ_LOCKED_ASSERT(uc);
for (;;) { for (;;) {
if (!(uq->uq_flags & UQF_UMTXQ)) if (!(uq->uq_flags & UQF_UMTXQ))
return (0); return (0);
if (timo != NULL) { if (abstime != NULL) {
pulse = abs_timeout_gethz(timo); timo = abs_timeout_gethz(abstime);
if (pulse < 0) if (timo < 0)
return (ETIMEDOUT); return (ETIMEDOUT);
} else } else
pulse = 0; timo = 0;
error = msleep(uq, &uc->uc_lock, PCATCH|PDROP, wmesg, pulse); error = msleep(uq, &uc->uc_lock, PCATCH | PDROP, wmesg, timo);
if (error != EWOULDBLOCK) { if (error != EWOULDBLOCK) {
umtxq_lock(&uq->uq_key); umtxq_lock(&uq->uq_key);
break; break;
} }
abs_timeout_update(timo); if (abstime != NULL)
abs_timeout_update(abstime);
umtxq_lock(&uq->uq_key); umtxq_lock(&uq->uq_key);
} }
return (error); return (error);